[v9.5.x] Loki: Fix log samples using instant queries (#67271) (#67275)

Loki: Fix log samples using `instant` queries (#67271)

change log samples queryType to always be `range`

(cherry picked from commit d51e63520c)
This commit is contained in:
Sven Grossmann
2023-04-26 12:42:04 +01:00
committed by GitHub
parent 33475a38f5
commit 2cce94c70d
2 changed files with 4 additions and 4 deletions
@@ -982,8 +982,7 @@ describe('LokiDatasource', () => {
})
).toEqual({
expr: 'sum by (level) (count_over_time({label=value}[$__interval]))',
instant: false,
queryType: 'range',
queryType: LokiQueryType.Range,
refId: 'log-volume-A',
supportingQueryType: SupportingQueryType.LogsVolume,
});
@@ -1035,7 +1034,7 @@ describe('LokiDatasource', () => {
})
).toEqual({
expr: '{label=value}',
queryType: 'instant',
queryType: LokiQueryType.Range,
refId: 'log-sample-A',
maxLines: 100,
});
@@ -195,7 +195,7 @@ export class LokiDatasource
return {
...normalizedQuery,
refId: `${REF_ID_STARTER_LOG_VOLUME}${normalizedQuery.refId}`,
instant: false,
queryType: LokiQueryType.Range,
supportingQueryType: SupportingQueryType.LogsVolume,
expr: `sum by (level) (count_over_time(${expr}[$__interval]))`,
};
@@ -208,6 +208,7 @@ export class LokiDatasource
}
return {
...normalizedQuery,
queryType: LokiQueryType.Range,
refId: `${REF_ID_STARTER_LOG_SAMPLE}${normalizedQuery.refId}`,
expr: getLogQueryFromMetricsQuery(expr),
maxLines: 100,