mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Remove empty annotations tags (#32359)
* Loki - filter labels with empty values Signed-off-by: Conor Evans <coevans@tcd.ie> * Apply prettier change Signed-off-by: Conor Evans <coevans@tcd.ie> * Apply Piotr's suggestion - swap map/filter statements Signed-off-by: Conor Evans <coevans@tcd.ie>
This commit is contained in:
parent
8bb56fabe0
commit
3af573ea96
@ -469,7 +469,9 @@ describe('LokiDatasource', () => {
|
||||
},
|
||||
{
|
||||
stream: {
|
||||
label: '', // empty value gets filtered
|
||||
label2: 'value2',
|
||||
label3: ' ', // whitespace value gets trimmed then filtered
|
||||
},
|
||||
values: [['1549024057498000000', 'hello 2']],
|
||||
},
|
||||
|
@ -511,7 +511,13 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
|
||||
const tags: string[] = [];
|
||||
for (const field of frame.fields) {
|
||||
if (field.labels) {
|
||||
tags.push.apply(tags, [...new Set(Object.values(field.labels).map((label: string) => label.trim()))]);
|
||||
tags.push.apply(tags, [
|
||||
...new Set(
|
||||
Object.values(field.labels)
|
||||
.map((label: string) => label.trim())
|
||||
.filter((label: string) => label !== '')
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
const view = new DataFrameView<{ ts: string; line: string }>(frame);
|
||||
|
Loading…
Reference in New Issue
Block a user