Browse Source

feat(perf-view) Add metric for key transaction use (#20749)

Track key transactions being marked from performance summary.

Refs getsentry/reload#179
Mark Story 4 years ago
parent
commit
e56c9e8856

+ 8 - 1
src/sentry/static/sentry/app/views/performance/transactionSummary/keyTransactionButton.tsx

@@ -7,6 +7,7 @@ import {IconStar} from 'app/icons';
 import {t} from 'app/locale';
 import EventView from 'app/utils/discover/eventView';
 import {Organization} from 'app/types';
+import {trackAnalyticsEvent} from 'app/utils/analytics';
 import {saveKeyTransaction, deleteKeyTransaction} from 'app/actionCreators/performance';
 
 type Props = {
@@ -99,11 +100,17 @@ class KeyTransactionButton extends React.Component<Props, State> {
     const {eventView, api, organization, transactionName} = this.props;
     const projects = eventView.project as number[];
 
+    trackAnalyticsEvent({
+      eventName: 'Performance Views: Key Transaction toggle',
+      eventKey: 'performance_views.key_transaction.toggle',
+      orgId: parseInt(organization.id, 10),
+      action: this.state.isKeyTransaction ? 'remove' : 'add',
+    });
+
     if (!this.state.isKeyTransaction) {
       this.setState({
         isKeyTransaction: true,
       });
-
       saveKeyTransaction(api, organization.slug, projects, transactionName).catch(() => {
         this.setState({
           isKeyTransaction: false,