Skip to content

Commit

Permalink
Loki: Add logsample supporting query type (grafana#92082)
Browse files Browse the repository at this point in the history
* Loki: Add `logsample` supporting query type

* use `SupportingQueryType`

* add missing test
  • Loading branch information
svennergr authored Aug 22, 2024
1 parent db711d6 commit 40cdfeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions public/app/plugins/datasource/loki/datasource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ describe('LokiDatasource', () => {
queryType: 'range',
refId: 'log-sample-A',
maxLines: 20,
supportingQueryType: SupportingQueryType.LogsSample,
});
});

Expand All @@ -1547,6 +1548,7 @@ describe('LokiDatasource', () => {
queryType: LokiQueryType.Range,
refId: 'log-sample-A',
maxLines: 20,
supportingQueryType: SupportingQueryType.LogsSample,
});
});

Expand All @@ -1564,6 +1566,7 @@ describe('LokiDatasource', () => {
expr: '{label="value"}',
queryType: LokiQueryType.Range,
refId: 'log-sample-A',
supportingQueryType: SupportingQueryType.LogsSample,
maxLines: 5,
});
});
Expand Down
1 change: 1 addition & 0 deletions public/app/plugins/datasource/loki/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export class LokiDatasource
refId: `${REF_ID_STARTER_LOG_SAMPLE}${normalizedQuery.refId}`,
expr: getLogQueryFromMetricsQuery(expr),
maxLines: Number.isNaN(Number(options.limit)) ? this.maxLines : Number(options.limit),
supportingQueryType: SupportingQueryType.LogsSample,
};

default:
Expand Down

0 comments on commit 40cdfeb

Please sign in to comment.