Track "view in context" usage (#74752)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
9295378d59
commit
cf65b6ba8c
|
@ -8,7 +8,7 @@ import React, { memo, useState, useCallback, useMemo } from 'react';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { isEmpty } from 'lodash';
|
||||
|
||||
import { euiStyled } from '../../../../../observability/public';
|
||||
import { euiStyled, useUiTracker } from '../../../../../observability/public';
|
||||
import { isTimestampColumn } from '../../../utils/log_entry';
|
||||
import {
|
||||
LogColumnConfiguration,
|
||||
|
@ -68,6 +68,8 @@ export const LogEntryRow = memo(
|
|||
scale,
|
||||
wrap,
|
||||
}: LogEntryRowProps) => {
|
||||
const trackMetric = useUiTracker({ app: 'infra_logs' });
|
||||
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
|
@ -82,10 +84,10 @@ export const LogEntryRow = memo(
|
|||
logEntry.id,
|
||||
]);
|
||||
|
||||
const handleOpenViewLogInContext = useCallback(() => openViewLogInContext?.(logEntry), [
|
||||
openViewLogInContext,
|
||||
logEntry,
|
||||
]);
|
||||
const handleOpenViewLogInContext = useCallback(() => {
|
||||
openViewLogInContext?.(logEntry); // eslint-disable-line no-unused-expressions
|
||||
trackMetric({ metric: 'view_in_context__stream' });
|
||||
}, [openViewLogInContext, logEntry, trackMetric]);
|
||||
|
||||
const hasContext = useMemo(() => !isEmpty(logEntry.context), [logEntry]);
|
||||
const hasActionFlyoutWithItem = openFlyoutWithItem !== undefined;
|
||||
|
|
|
@ -26,6 +26,7 @@ import {
|
|||
import { LogColumnConfiguration } from '../../../../../utils/source_configuration';
|
||||
import { LogEntryContextMenu } from '../../../../../components/logging/log_text_stream/log_entry_context_menu';
|
||||
import { useLinkProps } from '../../../../../hooks/use_link_props';
|
||||
import { useUiTracker } from '../../../../../../../observability/public';
|
||||
|
||||
export const exampleMessageScale = 'medium' as const;
|
||||
export const exampleTimestampFormat = 'dateTime' as const;
|
||||
|
@ -39,6 +40,7 @@ export const CategoryExampleMessage: React.FunctionComponent<{
|
|||
tiebreaker: number;
|
||||
context: LogEntryContext;
|
||||
}> = ({ id, dataset, message, timestamp, timeRange, tiebreaker, context }) => {
|
||||
const trackMetric = useUiTracker({ app: 'infra_logs' });
|
||||
const [, { setContextEntry }] = useContext(ViewLogInContext.Context);
|
||||
// handle special cases for the dataset value
|
||||
const humanFriendlyDataset = getFriendlyNameForPartitionId(dataset);
|
||||
|
@ -129,6 +131,7 @@ export const CategoryExampleMessage: React.FunctionComponent<{
|
|||
cursor: { time: timestamp, tiebreaker },
|
||||
columns: [],
|
||||
};
|
||||
trackMetric({ metric: 'view_in_context__categories' });
|
||||
|
||||
setContextEntry(logEntry);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue