mirror of https://github.com/grafana/grafana.git
CloudWatch: Fix logs query requestId to prevent setting undefined-logs as a requestId (#109930)
This commit is contained in:
parent
5bbb7c1e2a
commit
629cb1dee0
|
|
@ -76,6 +76,17 @@ describe('CloudWatchLogsQueryRunner', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('does not append -logs to the requestId if requestId is not provided', async () => {
|
||||
const { runner, queryMock } = setupMockedLogsQueryRunner();
|
||||
|
||||
const request = {
|
||||
...LogsRequestMock,
|
||||
};
|
||||
await expect(runner.handleLogQueries(LogsRequestMock.targets, request, queryMock)).toEmitValuesWith(() => {
|
||||
expect(queryMock.mock.calls[0][0].requestId).toEqual('');
|
||||
});
|
||||
});
|
||||
|
||||
it('should request to start each query and then request to get the query results', async () => {
|
||||
const { runner } = setupMockedLogsQueryRunner();
|
||||
|
||||
|
|
|
|||
|
|
@ -415,12 +415,14 @@ export class CloudWatchLogsQueryRunner extends CloudWatchRequest {
|
|||
options?: DataQueryRequest<CloudWatchQuery>
|
||||
): Observable<DataQueryResponse> {
|
||||
const range = options?.range || getDefaultTimeRange();
|
||||
// append -logs to prevent requestId from matching metric queries from the same panel
|
||||
const requestId = options?.requestId ? `${options?.requestId}-logs` : '';
|
||||
|
||||
const requestParams: DataQueryRequest<CloudWatchLogsQuery> = {
|
||||
...options,
|
||||
range,
|
||||
skipQueryCache: true,
|
||||
requestId: options?.requestId + '-logs' || '', // adding -logs to prevent requestId from matching metric queries from the same panel
|
||||
requestId,
|
||||
interval: options?.interval || '', // dummy
|
||||
intervalMs: options?.intervalMs || 1, // dummy
|
||||
scopedVars: options?.scopedVars || {}, // dummy
|
||||
|
|
|
|||
Loading…
Reference in New Issue