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

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

* remove unnecessary comment
This commit is contained in:
Sven Grossmann 2023-01-18 10:14:42 +01:00 committed by GitHub
parent a5d577eca1
commit 6c566a391d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

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

View File

@ -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,