mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
20616eef8c
commit
c0f5183330
@ -8,6 +8,11 @@ import { createLogRow } from './__mocks__/logRow';
|
|||||||
|
|
||||||
const row = createLogRow({ entry: '4', timeEpochMs: 4 });
|
const row = createLogRow({ entry: '4', timeEpochMs: 4 });
|
||||||
|
|
||||||
|
jest.mock('@grafana/runtime', () => ({
|
||||||
|
...jest.requireActual('@grafana/runtime'),
|
||||||
|
reportInteraction: jest.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
describe('getRowContexts', () => {
|
describe('getRowContexts', () => {
|
||||||
describe('when called with a DataFrame and results are returned', () => {
|
describe('when called with a DataFrame and results are returned', () => {
|
||||||
it('then the result should be in correct format and filtered', async () => {
|
it('then the result should be in correct format and filtered', async () => {
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
LogsSortOrder,
|
LogsSortOrder,
|
||||||
toDataFrame,
|
toDataFrame,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
|
|
||||||
export interface RowContextOptions {
|
export interface RowContextOptions {
|
||||||
direction?: 'BACKWARD' | 'FORWARD';
|
direction?: 'BACKWARD' | 'FORWARD';
|
||||||
@ -210,7 +211,16 @@ export const LogRowContextProvider: React.FunctionComponent<LogRowContextProvide
|
|||||||
after: result ? result.errors[1] : undefined,
|
after: result ? result.errors[1] : undefined,
|
||||||
},
|
},
|
||||||
hasMoreContextRows,
|
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,
|
limit,
|
||||||
logsSortOrder,
|
logsSortOrder,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user