Logs: Add feature tracking to the load more button in log row context (#57079)

* add feature tracking for the load more button in log row context

* fix test by mocking reportInteraction

* track the new log row limit
This commit is contained in:
Gareth Dawson 2022-10-19 10:02:26 +01:00 committed by GitHub
parent 20616eef8c
commit c0f5183330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -8,6 +8,11 @@ import { createLogRow } from './__mocks__/logRow';
const row = createLogRow({ entry: '4', timeEpochMs: 4 });
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
reportInteraction: jest.fn(),
}));
describe('getRowContexts', () => {
describe('when called with a DataFrame and results are returned', () => {
it('then the result should be in correct format and filtered', async () => {

View File

@ -10,6 +10,7 @@ import {
LogsSortOrder,
toDataFrame,
} from '@grafana/data';
import { reportInteraction } from '@grafana/runtime';
export interface RowContextOptions {
direction?: 'BACKWARD' | 'FORWARD';
@ -210,7 +211,16 @@ export const LogRowContextProvider: React.FunctionComponent<LogRowContextProvide
after: result ? result.errors[1] : undefined,
},
hasMoreContextRows,
updateLimit: () => setLimit(limit + 10),
updateLimit: () => {
setLimit(limit + 10);
const { datasourceType, uid: logRowUid } = row;
reportInteraction('grafana_explore_logs_log_context_load_more_clicked', {
datasourceType,
logRowUid,
newLimit: limit + 10,
});
},
limit,
logsSortOrder,
});