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 @@ -118,7 +118,7 @@ export function ServiceInventory() {

return (
<>
<SearchBar showTimeComparison />
<SearchBar />
<EuiPage>
<EuiFlexGroup direction="column" gutterSize="s">
{displayMlCallout ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function TransactionDetails({
<h1>{transactionName}</h1>
</EuiTitle>
</ApmHeader>
<SearchBar showTimeComparison />
<SearchBar />
<EuiPage>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexGroup justifyContent="flexEnd">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function TransactionOverview({ serviceName }: TransactionOverviewProps) {

return (
<>
<SearchBar showTimeComparison />
<SearchBar />

<EuiPage>
<EuiFlexGroup direction="column" gutterSize="s">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('TransactionOverview', () => {
});

expect(history.location.search).toEqual(
'?transactionType=secondType&rangeFrom=now-15m&rangeTo=now&comparisonEnabled=true&comparisonType=day'
'?transactionType=secondType&rangeFrom=now-15m&rangeTo=now'
);
expect(getByText(container, 'firstType')).toBeInTheDocument();
expect(getByText(container, 'secondType')).toBeInTheDocument();
Expand All @@ -142,7 +142,7 @@ describe('TransactionOverview', () => {

expect(history.push).toHaveBeenCalled();
expect(history.location.search).toEqual(
'?transactionType=firstType&rangeFrom=now-15m&rangeTo=now&comparisonEnabled=true&comparisonType=day'
'?transactionType=firstType&rangeFrom=now-15m&rangeTo=now'
);
});
});
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 @@ -130,6 +131,7 @@ function getSelectOptions({
}

export function TimeComparison() {
const trackApmEvent = useUiTracker({ app: 'apm' });
const history = useHistory();
const { isMedium, isLarge } = useBreakPoints();
const {
Expand Down Expand Up @@ -178,17 +180,25 @@ export function TimeComparison() {
defaultMessage: 'Comparison',
})}
checked={comparisonEnabled}
onChange={() => {
onChange={(e) => {
if (e.target.checked === false) {
trackApmEvent({
metric: 'time_comparison_disabled',
});
}
urlHelpers.push(history, {
query: {
comparisonEnabled: Boolean(!comparisonEnabled).toString(),
comparisonEnabled: Boolean(e.target.checked).toString(),
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
},
});
}}
/>
</PrependContainer>
}
onChange={(e) => {
trackApmEvent({
metric: `time_comparison_type_change_${e.target.value}`,
});
urlHelpers.push(history, {
query: {
comparisonType: e.target.value,
Expand Down