Tempo: Add options to getTagKeys (#108691)

Add options to getTagKeys so time range and timeRangeForTags can be passed into the Tempo language provider
This commit is contained in:
Joey
2025-07-28 09:36:07 +01:00
committed by GitHub
parent cef7f2b337
commit d529eee8cf
2 changed files with 14 additions and 3 deletions
@@ -1227,7 +1227,17 @@ describe('should provide functionality for ad-hoc filters', () => {
});
it('for getTagKeys', async () => {
const response = await datasource.getTagKeys();
const response = await datasource.getTagKeys({
filters: [],
timeRange: {
from: dateTime('2021-04-20T15:55:00Z'),
to: dateTime('2021-04-20T15:55:00Z'),
raw: {
from: 'now-15m',
to: 'now',
},
},
});
expect(response).toEqual([{ text: 'span.label1' }, { text: 'span.label2' }]);
});
@@ -11,6 +11,7 @@ import {
DataQueryRequest,
DataQueryResponse,
DataQueryResponseData,
DataSourceGetTagKeysOptions,
DataSourceGetTagValuesOptions,
DataSourceInstanceSettings,
dateTime,
@@ -238,8 +239,8 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
}
// Allows to retrieve the list of tags for ad-hoc filters
async getTagKeys(): Promise<Array<{ text: string }>> {
await this.languageProvider.fetchTags();
async getTagKeys(options: DataSourceGetTagKeysOptions<TempoQuery>): Promise<Array<{ text: string }>> {
await this.languageProvider.fetchTags(this.timeRangeForTags, options.timeRange);
const tags = this.languageProvider.tagsV2 || [];
return tags
.map(({ name, tags }) =>