[9.3.x] Loki: Use queries maxLines if configured, even if it is zero (#61652) (#61657)

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

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

* remove unnecessary comment

(cherry picked from commit 6c566a391d)
This commit is contained in:
Sven Grossmann
2023-01-18 09:32:11 +00:00
committed by GitHub
parent b42544526e
commit f5a52c8f0e
2 changed files with 5 additions and 1 deletions
@@ -156,6 +156,10 @@ describe('LokiDatasource', () => {
it('should use query max lines, if both exist, even if it is higher than ds max lines', async () => {
await runTest(80, '40', 80);
});
it('should use query max lines, if both exist, even if it is 0', async () => {
await runTest(0, '40', 0);
});
});
describe('When using adhoc filters', () => {
@@ -162,7 +162,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 = {
...request,