Skip to content

Commit e3d2738

Browse files
committed
Add extra data to measurement
1 parent dc520f8 commit e3d2738

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/app/src/sandbox/compile.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ParsedConfigurationFiles } from '@codesandbox/common/lib/templates/temp
66
import _debug from '@codesandbox/common/lib/utils/debug';
77
import { isBabel7 } from '@codesandbox/common/lib/utils/is-babel-7';
88
import { absolute } from '@codesandbox/common/lib/utils/path';
9+
import VERSION from '@codesandbox/common/lib/version';
910
import { clearErrorTransformers, dispatch, reattach } from 'codesandbox-api';
1011
import { flatten } from 'lodash';
1112
import initializeErrorTransformers from 'sandbox-hooks/errors/transformers';
@@ -485,6 +486,7 @@ async function compile({
485486

486487
dependencies = await manager.preset.processDependencies(dependencies);
487488

489+
metrics.measure('dependencies');
488490
const { manifest, isNewCombination } = await loadDependencies(
489491
dependencies,
490492
{
@@ -493,6 +495,7 @@ async function compile({
493495
showFullScreen: firstLoad,
494496
}
495497
);
498+
metrics.endMeasure('dependencies', 'Dependencies');
496499

497500
const shouldReloadManager =
498501
(isNewCombination && !firstLoad) || manager.id !== sandboxId;
@@ -741,8 +744,9 @@ async function compile({
741744
if (firstLoad) {
742745
metrics.persistMeasurements({
743746
sandboxId,
744-
usedCache,
747+
cacheUsed: usedCache,
745748
browser: navigator.userAgent,
749+
version: VERSION,
746750
});
747751
}
748752
}

packages/app/src/sandbox/utils/metrics.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ const MEASUREMENT_API = `https://30vlq6h5qc.execute-api.eu-west-1.amazonaws.com/
3838

3939
export function persistMeasurements(data: {
4040
sandboxId: string;
41-
usedCache: boolean;
41+
cacheUsed: boolean;
4242
browser: string;
43+
version: string;
4344
}) {
4445
if (process.env.NODE_ENV === 'development') {
4546
return Promise.resolve();

0 commit comments

Comments
 (0)