Loki: Hide internal labels (#97323)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user