Loki: Use queries `maxLines` if configured, even if it is zero (#61652)

* user `query.maxLines` even if it is zero

* remove unnecessary comment
pull/61570/head
Sven Grossmann 3 years ago committed by GitHub
parent a5d577eca1
commit 6c566a391d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      public/app/plugins/datasource/loki/datasource.test.ts
  2. 2
      public/app/plugins/datasource/loki/datasource.ts

@ -176,6 +176,10 @@ describe('LokiDatasource', () => {
await runTest(80, '40', 80, undefined);
});
it('should use query max lines, if both exist, even if it is 0', async () => {
await runTest(0, '40', 0, undefined);
});
it('should report query interaction', async () => {
await runTest(80, '40', 80, CoreApp.Explore);
expect(reportInteraction).toHaveBeenCalledWith(

@ -174,7 +174,7 @@ export class LokiDatasource
query(request: DataQueryRequest<LokiQuery>): Observable<DataQueryResponse> {
const queries = request.targets
.map(getNormalizedLokiQuery) // "fix" the `.queryType` prop
.map((q) => ({ ...q, maxLines: q.maxLines || this.maxLines })); // set maxLines if not set
.map((q) => ({ ...q, maxLines: q.maxLines ?? this.maxLines }));
const fixedRequest: DataQueryRequest<LokiQuery> & { targets: LokiQuery[] } = {
...request,

Loading…
Cancel
Save