Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Telemetry: Add UI usage telemetry on the Timeseries comparison feature #91439

Merged
merged 9 commits into from
Mar 16, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export function TransactionOverview({ serviceName }: TransactionOverviewProps) {
return (
<>
<SearchBar showCorrelations />

<EuiPage>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiSpacer size="s" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { i18n } from '@kbn/i18n';
import moment from 'moment';
import React from 'react';
import { useHistory } from 'react-router-dom';
import { useUiTracker } from '../../../../../observability/public';
import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common';
import { getDateDifference } from '../../../../common/utils/formatters';
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
Expand Down Expand Up @@ -132,6 +133,7 @@ function getSelectOptions({
}

export function TimeComparison() {
const trackApmEvent = useUiTracker({ app: 'apm' });
const history = useHistory();
const { isMedium, isLarge } = useBreakPoints();
const {
Expand Down Expand Up @@ -181,16 +183,27 @@ export function TimeComparison() {
})}
checked={comparisonEnabled}
onChange={() => {
const nextComparisonEnabledValue = !comparisonEnabled;
if (nextComparisonEnabledValue === false) {
trackApmEvent({
metric: 'time_comparison_disabled',
});
}
urlHelpers.push(history, {
query: {
comparisonEnabled: Boolean(!comparisonEnabled).toString(),
comparisonEnabled: Boolean(
nextComparisonEnabledValue
).toString(),
},
});
}}
/>
</PrependContainer>
}
onChange={(e) => {
trackApmEvent({
metric: `time_comparison_type_change_${e.target.value}`,
});
urlHelpers.push(history, {
query: {
comparisonType: e.target.value,
Expand Down