Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
feat(profiler): set logging mode as tag
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Oct 19, 2022
1 parent 3fa086e commit f2517f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/hubextensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,15 @@ export function __PRIVATE__wrapStartTransactionWithProfiling(startTransaction: S
}, MAX_PROFILE_DURATION_MS);

function profilingWrappedTransactionFinish() {
// @ts-expect-error profile is not a part of sdk metadata so we expect error until it becomes part of the official SDK.
// onProfileHandler should always return the same profile even if this is called multiple times.
// Always call onProfileHandler to ensure stopProfiling is called and the timeout is cleared.
transaction.setMetadata({ profile: onProfileHandler() });
const profile = onProfileHandler();
// If we receive a profile, set the logging mode that was used as a tag
if (profile) {
transaction.setTag('profiler_logging_mode', profile.profiler_logging_mode);
}
// @ts-expect-error profile is not a part of sdk metadata so we expect error until it becomes part of the official SDK.
transaction.setMetadata({ profile });
return originalFinish();
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export function createProfilingEventEnvelope(
timestamp: new Date(transactionStartMs).toISOString(),
platform: 'node',
version: '1',
release: event.sdk?.version || 'unknown',
release: event.sdk?.version || 'unknown'
runtime: {
name: 'node',
version: process.versions.node
Expand Down

0 comments on commit f2517f6

Please sign in to comment.