Skip to content

Commit f088c4f

Browse files
committed
Add basic metrics to Send page
1 parent f9a1360 commit f088c4f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/components/view/view-page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { SendStore } from '../../model/send/send-store';
3030
import { HttpExchange } from '../../model/http/exchange';
3131
import { FilterSet } from '../../model/filters/search-filters';
3232
import { buildRuleFromExchange } from '../../model/rules/rule-creation';
33-
import { buildRequestInputFromExchange } from '../../model/send/send-request-model';
3433

3534
import { SplitPane } from '../split-pane';
3635
import { EmptyState } from '../common/empty-state';
@@ -449,7 +448,7 @@ class ViewPage extends React.Component<ViewPageProps> {
449448
@action.bound
450449
async onPrepareToResendRequest(exchange: HttpExchange) {
451450
const { sendStore, navigate } = this.props;
452-
sendStore.addRequestInput(await buildRequestInputFromExchange(exchange));
451+
await sendStore.addRequestInputFromExchange(exchange);
453452
navigate(`/send`);
454453
}
455454

src/model/send/send-store.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { lazyObservablePromise } from '../../util/observable';
1414
import { persist, hydrate } from '../../util/mobx-persist/persist';
1515
import { ErrorLike, UnreachableCheck } from '../../util/error';
1616
import { rawHeadersToHeaders } from '../../util/headers';
17+
import { trackEvent } from '../../metrics';
1718

1819
import { EventsStore } from '../events/events-store';
1920
import { RulesStore } from '../rules/rules-store';
@@ -22,6 +23,7 @@ import * as ServerApi from '../../services/server-api';
2223
import { HttpExchange } from '../http/exchange';
2324
import { ResponseHeadEvent, ResponseStreamEvent } from './send-response-model';
2425
import {
26+
buildRequestInputFromExchange,
2527
ClientProxyConfig,
2628
RequestInput,
2729
requestInputSchema,
@@ -62,10 +64,20 @@ export class SendStore {
6264
return requestInput;
6365
}
6466

67+
async addRequestInputFromExchange(exchange: HttpExchange) {
68+
trackEvent({ category: 'Send', action: 'Resend exchange' });
69+
70+
this.addRequestInput(
71+
await buildRequestInputFromExchange(exchange)
72+
);
73+
}
74+
6575
@observable
6676
sentExchange: HttpExchange | undefined;
6777

6878
readonly sendRequest = async (requestInput: RequestInput) => {
79+
trackEvent({ category: 'Send', action: 'Sent request' });
80+
6981
const exchangeId = uuid();
7082

7183
const passthroughOptions = this.rulesStore.activePassthroughOptions;

0 commit comments

Comments
 (0)