Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(node): Add context info for missing instrumentation #12639

Merged
merged 5 commits into from
Jun 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/node/src/utils/ensureIsWrapped.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isWrapped } from '@opentelemetry/core';
import { hasTracingEnabled, isEnabled } from '@sentry/core';
import { getCurrentScope, hasTracingEnabled, isEnabled } from '@sentry/core';
import { consoleSandbox } from '@sentry/utils';
import { isCjs } from './commonjs';

Expand All @@ -24,5 +24,10 @@ export function ensureIsWrapped(
);
}
});

getCurrentScope().setContext('Instrumentation', {
Copy link
Member

@mydea mydea Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: This should be getGlobalScope(), I'd say - the current scope is very "volatile", putting this on the global scope ensures it will always be there!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was not sure about the scope, for the case if we have multiple frameworks in a project, would they overwrite each other?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the last would win! IMHO that's probably OK, but maybe you can also check with other folks on the team what they think about this :)

isMissing: true,
framework: name,
chargome marked this conversation as resolved.
Show resolved Hide resolved
});
}
}
Loading