diff --git a/public/app/plugins/datasource/loki/datasource.test.ts b/public/app/plugins/datasource/loki/datasource.test.ts index 6a729aa41a0..6afcf983a8f 100644 --- a/public/app/plugins/datasource/loki/datasource.test.ts +++ b/public/app/plugins/datasource/loki/datasource.test.ts @@ -1254,6 +1254,15 @@ describe('LokiDatasource', () => { }) ); }); + it('sets the supporting query type in the request', () => { + const spy = jest.spyOn(ds, 'query').mockImplementation(() => of({} as DataQueryResponse)); + ds.getDataSamples({ expr: '{job="bar"}', refId: 'A' }); + expect(spy).toHaveBeenCalledWith( + expect.objectContaining({ + targets: [expect.objectContaining({ supportingQueryType: SupportingQueryType.DataSample })], + }) + ); + }); }); describe('Query splitting', () => { diff --git a/public/app/plugins/datasource/loki/datasource.ts b/public/app/plugins/datasource/loki/datasource.ts index 681144242f6..e75462608c2 100644 --- a/public/app/plugins/datasource/loki/datasource.ts +++ b/public/app/plugins/datasource/loki/datasource.ts @@ -763,6 +763,7 @@ export class LokiDatasource refId: REF_ID_DATA_SAMPLES, // For samples we limit the request to 10 lines, so queries are small and fast maxLines: 10, + supportingQueryType: SupportingQueryType.DataSample, }; const timeRange = this.getTimeRange();