-
Notifications
You must be signed in to change notification settings - Fork 1
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 Example #1
base: main
Are you sure you want to change the base?
Fix Example #1
Conversation
@@ -49,7 +49,6 @@ const sentryClient = Sentry.init({ | |||
|
|||
console.log('sentryClient is defined:', !!sentryClient); | |||
const provider = new NodeTracerProvider({ | |||
sampler: new SentrySampler(sentryClient!), |
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.
we can skip the sampler if we really don't care about distributed tracing etc. I'd still recommend to wrap your own sampler with wrapSamplingDecision
but it should generally work this way too.
@@ -27,9 +25,11 @@ const sentryClient = Sentry.init({ | |||
release, | |||
environment, | |||
skipOpenTelemetrySetup: true, | |||
tracesSampleRate: 1.0, |
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.
Removing this leads to Sentry not adding non-essential OTEL instrumentation out of the box.
console.dir( | ||
{ | ||
whoami: 'sentry:beforeSend', | ||
event: { contexts, exception, extra, tags, message, user }, |
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.
I just reduced this to make it easier to parse the user/tags etc.
registerInstrumentations({ | ||
instrumentations: [new ExpressInstrumentation(), new HttpInstrumentation()], |
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.
Express has to be added if you care about it, only http can/should be skipped 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.
Gotcha - that makes sense. I thought this could be it. But since Sentry.httpIntegration
took care of OTEL httpInstrumentation, i thought the Sentry Express integration may do the same.
@mydea - i didn't notice any changes to forking the isolation scope for this update. Do we still need to fork it? I wasn't sure as you seemed to mention that Middleware is correctly isolated in express (so long as we don't manually register our own Http Instrumentation) |
Yes, so as long as our custom http instrumentation is there, no need to do any custom forking - this is basically what we do in there. I opened a PR to provide a way to also avoid this, but this is WIP: getsentry/sentry-javascript#13719 |
I'm not sure that's the case. For example, in your branch here, if you comment simply remove the Furthermore, if The In order for Sentry scope request isolation and OTEL to export spans, I only seem to get it working by:
Here's an updated branch of mine that i've included some of your recommendations here including a custom sampler that uses |
Okay it looks like i figured the major point of confusion:
Next - to fork or not to fork If If Conclusion Here are the following choices we have:
OR
Some wish lists from Sentry
|
so, if no DSN is set, sentry is disabled and no integrations are run. Why would you care about sentry stuff being isolated if nothing is sent/done? This should not affect your app at all - but for the sake of testing sentry stuff, you always need to set a DSN in order to test how stuff behaves :) Regarding docs, we have docs specifically for this case here: https://docs.sentry.io/platforms/javascript/guides/node/opentelemetry/custom-setup/#using-sentry-for-error-monitoring-only - there are for sure some rough edges there that we're striving to improve, but by following the docs there it should be possible to set up everything in a way that works (this page also describes the limitations around http instrumentation). If it is the case that the http spans do not work with a custom tracer, that would be something we need to fix of course! But we have an E2E test app specifically for this scenario here: https://github.com/getsentry/sentry-javascript/blob/develop/dev-packages/e2e-tests/test-applications/node-otel-without-tracing/tests/transactions.test.ts which seems to me to work, http spans are sent to my custom tracer if I do not manually add the http instrumentation 🤔 |
Yea I am definitely nitpicking on that one! Ultimately, we didn't expect something like Scope behavior to change based on the libraries
100% agree - The documentation is quite vast and to IMO it's pretty darn good. Admittedly our setup quite custom and we more than appreciate your time in helping us understand how all of the config works together.
You are correct. Sentry's registration of both
I think your idea to provide a method that returns the instance of |
Thanks you for all the feedback! We will continue to work on improving the http instrumentation story - we are investigating a few options there, but we def. want to make this as un-confusing as possible 🙏 Conversations like this help us a lot in figuring out rough spots in our docs and setup and making this as easy to use as we can! I hope you've got stuff working for now - if you have any more questions, please never hesitate to reach out to us! |
Sounds great! Thanks for all your time - we actually deployed some updates yesterday that appear to be working as intended. |
This seems to make it work for me.
If you remove
tracesSampleRate
, only minimal instrumentation will be added (=Http). You can then add other instrumentation (e.g. http) on your own, only http should be skipped. We'll look into making this more ergonomic too...!