Loki: Add `supportingQueryType` to datasample queries (#77482)

add `supportingQueryType` to datasamples
pull/77498/head
Sven Grossmann 2 years ago committed by GitHub
parent 2d5e602b2d
commit 57835c71b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      public/app/plugins/datasource/loki/datasource.test.ts
  2. 1
      public/app/plugins/datasource/loki/datasource.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', () => {

@ -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();

Loading…
Cancel
Save