Skip to content

Commit

Permalink
Merge pull request #76 from bitmovin/feature/AN-3212/AN-4131_implemen…
Browse files Browse the repository at this point in the history
…t-the-200-row-limit-warning-message

feature/AN-3212/AN-4131_implement-the-200-row-limit-warning-message
  • Loading branch information
Svarozic authored Jun 17, 2024
2 parents 45e9677 + 15f217e commit d79b99c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bitmovin-analytics-datasource/src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
DataSourceApi,
DataSourceInstanceSettings,
Field,
QueryResultMetaNotice,
} from '@grafana/data';
import { getBackendSrv } from '@grafana/runtime';
import { filter } from 'lodash';
Expand Down Expand Up @@ -99,6 +100,7 @@ export class DataSource extends DataSourceApi<BitmovinAnalyticsDataQuery, Bitmov
);

const dataRows: MixedDataRowList = response.data.data.result.rows;
const dataRowCount: number = response.data.data.result.rowCount;
const columnLabels: Array<{ key: string; label: string }> = response.data.data.result.columnLabels;

const fields: Array<Partial<Field>> = [];
Expand All @@ -125,9 +127,20 @@ export class DataSource extends DataSourceApi<BitmovinAnalyticsDataQuery, Bitmov
}
}

let metaNotices: QueryResultMetaNotice[] = [];
if (dataRowCount >= 200) {
metaNotices = [
{
severity: 'warning',
text: 'Your request reached the max row limit of the API. You might see incomplete data. This problem might be caused by the use of high cardinality columns in group by, too small interval, or too big of a time range.',
},
];
}

return createDataFrame({
name: target.aliasBy,
fields: fields,
meta: { notices: metaNotices },
});
});

Expand Down

0 comments on commit d79b99c

Please sign in to comment.