Commit 76f4c114 by Andrej Ocenas Committed by GitHub

CloudWatch Logs: Change what we use to measure progress (#28912)

parent f22d7710
...@@ -336,7 +336,7 @@ export class CloudWatchDatasource extends DataSourceApi<CloudWatchQuery, CloudWa ...@@ -336,7 +336,7 @@ export class CloudWatchDatasource extends DataSourceApi<CloudWatchQuery, CloudWa
({ failures, prevRecordsMatched }, frames) => { ({ failures, prevRecordsMatched }, frames) => {
failures++; failures++;
for (const frame of frames) { for (const frame of frames) {
const recordsMatched = frame.meta?.stats?.find(stat => stat.displayName === 'Records matched')?.value!; const recordsMatched = frame.meta?.stats?.find(stat => stat.displayName === 'Records scanned')?.value!;
if (recordsMatched > (prevRecordsMatched[frame.refId!] ?? 0)) { if (recordsMatched > (prevRecordsMatched[frame.refId!] ?? 0)) {
failures = 0; failures = 0;
} }
......
...@@ -186,23 +186,23 @@ describe('CloudWatchDatasource', () => { ...@@ -186,23 +186,23 @@ describe('CloudWatchDatasource', () => {
it('should stop querying when no more data received a number of times in a row', async () => { it('should stop querying when no more data received a number of times in a row', async () => {
const fakeFrames = genMockFrames(20); const fakeFrames = genMockFrames(20);
const initialRecordsMatched = fakeFrames[0].meta!.stats!.find(stat => stat.displayName === 'Records matched')! const initialRecordsMatched = fakeFrames[0].meta!.stats!.find(stat => stat.displayName === 'Records scanned')!
.value!; .value!;
for (let i = 1; i < 4; i++) { for (let i = 1; i < 4; i++) {
fakeFrames[i].meta!.stats = [ fakeFrames[i].meta!.stats = [
{ {
displayName: 'Records matched', displayName: 'Records scanned',
value: initialRecordsMatched, value: initialRecordsMatched,
}, },
]; ];
} }
const finalRecordsMatched = fakeFrames[9].meta!.stats!.find(stat => stat.displayName === 'Records matched')! const finalRecordsMatched = fakeFrames[9].meta!.stats!.find(stat => stat.displayName === 'Records scanned')!
.value!; .value!;
for (let i = 10; i < fakeFrames.length; i++) { for (let i = 10; i < fakeFrames.length; i++) {
fakeFrames[i].meta!.stats = [ fakeFrames[i].meta!.stats = [
{ {
displayName: 'Records matched', displayName: 'Records scanned',
value: finalRecordsMatched, value: finalRecordsMatched,
}, },
]; ];
...@@ -1198,7 +1198,7 @@ function genMockFrames(numResponses: number): DataFrame[] { ...@@ -1198,7 +1198,7 @@ function genMockFrames(numResponses: number): DataFrame[] {
}, },
stats: [ stats: [
{ {
displayName: 'Records matched', displayName: 'Records scanned',
value: (i + 1) * recordIncrement, value: (i + 1) * recordIncrement,
}, },
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment