Skip to content

Commit 40cdfeb

Browse files
authored
Loki: Add logsample supporting query type (grafana#92082)
* Loki: Add `logsample` supporting query type * use `SupportingQueryType` * add missing test
1 parent db711d6 commit 40cdfeb

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

public/app/plugins/datasource/loki/datasource.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,7 @@ describe('LokiDatasource', () => {
15291529
queryType: 'range',
15301530
refId: 'log-sample-A',
15311531
maxLines: 20,
1532+
supportingQueryType: SupportingQueryType.LogsSample,
15321533
});
15331534
});
15341535

@@ -1547,6 +1548,7 @@ describe('LokiDatasource', () => {
15471548
queryType: LokiQueryType.Range,
15481549
refId: 'log-sample-A',
15491550
maxLines: 20,
1551+
supportingQueryType: SupportingQueryType.LogsSample,
15501552
});
15511553
});
15521554

@@ -1564,6 +1566,7 @@ describe('LokiDatasource', () => {
15641566
expr: '{label="value"}',
15651567
queryType: LokiQueryType.Range,
15661568
refId: 'log-sample-A',
1569+
supportingQueryType: SupportingQueryType.LogsSample,
15671570
maxLines: 5,
15681571
});
15691572
});

public/app/plugins/datasource/loki/datasource.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ export class LokiDatasource
242242
refId: `${REF_ID_STARTER_LOG_SAMPLE}${normalizedQuery.refId}`,
243243
expr: getLogQueryFromMetricsQuery(expr),
244244
maxLines: Number.isNaN(Number(options.limit)) ? this.maxLines : Number(options.limit),
245+
supportingQueryType: SupportingQueryType.LogsSample,
245246
};
246247

247248
default:

0 commit comments

Comments
 (0)