mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Hide internal labels (#97323)
This commit is contained in:
parent
cdf7ac6fd8
commit
34134d0e90
@ -441,6 +441,14 @@ describe('Language completion provider', () => {
|
||||
start: 1560153109000,
|
||||
});
|
||||
});
|
||||
|
||||
it('should filter internal labels', async () => {
|
||||
const datasourceWithLabels = setup({ foo: [], bar: [], __name__: [], __stream_shard__: [] });
|
||||
|
||||
const instance = new LanguageProvider(datasourceWithLabels);
|
||||
const labels = await instance.fetchLabels();
|
||||
expect(labels).toEqual(['bar', 'foo']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -176,7 +176,7 @@ export default class LokiLanguageProvider extends LanguageProvider {
|
||||
const labels = res
|
||||
.slice()
|
||||
.sort()
|
||||
.filter((label) => label !== '__name__');
|
||||
.filter((label: string) => label.startsWith('__') === false);
|
||||
this.labelKeys = labels;
|
||||
return this.labelKeys;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user