-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(node): Improve OTEL validation logic #13079
Conversation
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a test for this?
We have tests covering that this actually works (e.g. not having span processor), it was just not nicely reflected in the warning messages. Sadly it is hard to test this properly because this runs in node on init, which makes it tricky to test this well in e.g. an e2e test. |
@@ -193,3 +195,65 @@ describe('init()', () => { | |||
}); | |||
}); | |||
}); | |||
|
|||
describe('validateOpenTelemetrySetup', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andreiborza added unit tests here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks :)
expect(warnSpy).toHaveBeenCalledTimes(1); | ||
|
||
expect(errorSpy).toBeCalledWith(expect.stringContaining('You have to set up the SentryContextManager.')); | ||
expect(errorSpy).toBeCalledWith(expect.stringContaining('You have to set up the SentryPropagator.')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: I think it would be good to also assert on the message we don't expect to show up as well, just relying on the number of times it has been called is error prone.
When using the SDK without tracing, the span processor is not required - we should reflect this in our validation logic.
While at it, I also improved the warning for not using the SentrySampler.