Skip to content

Commit b5f2408

Browse files
committed
WIP debug
1 parent 2448373 commit b5f2408

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Sentry.init({
77
integrations: [Sentry.browserTracingIntegration(), Sentry.feedbackIntegration()],
88
tracePropagationTargets: ['http://example.com'],
99
tracesSampleRate: 1,
10+
debug: true,
1011
});

dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,21 @@ sentryTest('creates a new trace on each navigation', async ({ getLocalTestUrl, p
6969
expect(navigation1TraceContext?.trace_id).not.toEqual(navigation2TraceContext?.trace_id);
7070
});
7171

72-
sentryTest('error after navigation has navigation traceId', async ({ getLocalTestUrl, page }) => {
72+
sentryTest.only('error after navigation has navigation traceId', async ({ getLocalTestUrl, page }) => {
7373
if (shouldSkipTracingTest()) {
7474
sentryTest.skip();
7575
}
7676

77+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
78+
return route.fulfill({
79+
status: 200,
80+
contentType: 'application/json',
81+
body: JSON.stringify({ id: 'test-id' }),
82+
});
83+
});
84+
85+
page.on('console', msg => console.log(msg.text()));
86+
7787
const url = await getLocalTestUrl({ testDir: __dirname });
7888

7989
// ensure pageload transaction is finished

packages/core/src/baseclient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,8 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
709709
dynamicSamplingContext,
710710
...evt.sdkProcessingMetadata,
711711
};
712+
713+
logger.log('xxx', JSON.stringify(evt.sdkProcessingMetadata, null, 2));
712714
}
713715
return evt;
714716
});

packages/core/src/envelope.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
createEventEnvelopeHeaders,
2121
dsnToString,
2222
getSdkMetadataForEnvelopeHeader,
23+
logger,
2324
} from '@sentry/utils';
2425
import { createSpanEnvelopeItem } from '@sentry/utils';
2526
import { getDynamicSamplingContextFromSpan } from './tracing/dynamicSamplingContext';
@@ -86,6 +87,9 @@ export function createEventEnvelope(
8687

8788
const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn);
8889

90+
logger.log(JSON.stringify(envelopeHeaders, null, 2));
91+
logger.log(JSON.stringify(event.sdkProcessingMetadata, null, 2));
92+
8993
// Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to
9094
// sentry. (Note: Our use of this property comes and goes with whatever we might be debugging, whatever hacks we may
9195
// have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid

packages/core/src/tracing/idleSpan.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ export function startIdleSpan(startSpanOptions: StartSpanOptions, options: Parti
239239
}
240240

241241
function onIdleSpanEnded(endTimestamp: number): void {
242-
_cleanupHooks.forEach(cleanup => cleanup());
243-
244242
_finished = true;
245243
activities.clear();
246244

245+
_cleanupHooks.forEach(cleanup => cleanup());
246+
247247
_setSpanForScope(scope, previousActiveSpan);
248248

249249
const spanJSON = spanToJSON(span);

0 commit comments

Comments
 (0)