Skip to content

Commit 17988a2

Browse files
committed
WIP debugging stuff???
1 parent e514b1f commit 17988a2

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Sentry.init({
3838
replaysSessionSampleRate: 1.0,
3939
replaysOnErrorSampleRate: 0.0,
4040

41-
debug: !!process.env.DEBUG,
41+
debug: true,
4242
});
4343

4444
const sentryCreateHashRouter = Sentry.wrapCreateBrowserRouter(createHashRouter);

dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ test('Captures a pageload transaction', async ({ page }) => {
66
return event.contexts?.trace?.op === 'pageload';
77
});
88

9+
page.on('console', msg => console.log(msg.text()));
10+
911
await page.goto('/');
1012

1113
const transactionEvent = await transactionEventPromise;
1214
expect(transactionEvent.contexts?.trace).toEqual({
13-
data: expect.objectContaining({
15+
data: {
1416
deviceMemory: expect.any(String),
1517
effectiveConnectionType: expect.any(String),
1618
hardwareConcurrency: expect.any(String),
@@ -19,7 +21,7 @@ test('Captures a pageload transaction', async ({ page }) => {
1921
'sentry.origin': 'auto.pageload.react.reactrouter_v6',
2022
'sentry.sample_rate': 1,
2123
'sentry.source': 'route',
22-
}),
24+
},
2325
op: 'pageload',
2426
span_id: expect.any(String),
2527
trace_id: expect.any(String),

packages/browser-utils/src/metrics/utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { SentrySpan } from '@sentry/core';
22
import { spanToJSON, startInactiveSpan, withActiveSpan } from '@sentry/core';
33
import type { Span, SpanTimeInput, StartSpanOptions } from '@sentry/types';
4+
import { logger } from '@sentry/utils';
5+
import { DEBUG_BUILD } from '../debug-build';
46
import { WINDOW } from '../types';
57

68
/**
@@ -20,12 +22,13 @@ export function startAndEndSpan(
2022
startTimeInSeconds: number,
2123
endTime: SpanTimeInput,
2224
{ ...ctx }: StartSpanOptions,
23-
): Span | undefined {
25+
): Span {
2426
const parentStartTime = spanToJSON(parentSpan).start_timestamp;
2527
if (parentStartTime && parentStartTime > startTimeInSeconds) {
2628
// We can only do this for SentrySpans...
2729
if (typeof (parentSpan as Partial<SentrySpan>).updateStartTime === 'function') {
2830
(parentSpan as SentrySpan).updateStartTime(startTimeInSeconds);
31+
DEBUG_BUILD && logger.log('Updated parent span start to start of child span.', ctx);
2932
}
3033
}
3134

@@ -36,9 +39,7 @@ export function startAndEndSpan(
3639
...ctx,
3740
});
3841

39-
if (span) {
40-
span.end(endTime);
41-
}
42+
span.end(endTime);
4243

4344
return span;
4445
});

0 commit comments

Comments
 (0)