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): Expose getHttpInstrumentationOptions utility #13719

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

mydea
Copy link
Member

@mydea mydea commented Sep 18, 2024

Related to getsentry/sentry-docs#11378

It can be a bit tricky/annoying for users with a custom otel setup to understand that they cannot add their own HttpInstrumentation, because this will overwrite ours which we need.

This PR exposes a new utility, getHttpInstrumentationOptions(), which can be used to define your own HttpInstrumentation:

registerInstrumentation({
  instrumentations: [
    new HttpInstrumentation(Sentry.getHttpInstrumentationOptions())
  ]
});

this way it does not matter that/if that overwrites the instrumentation we added in the first place, http instrumentation will still work as expected then.

@mydea mydea self-assigned this Sep 18, 2024
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Don't we have to re-export getHttpInstrumentationOptions in the metaframeworks as well?

It's a little annoying that we have to put getHttpInstrumentationOptions in the top level namespace, but I guess not a good way to go around this unless we add another field to httpIntegration (like Sentry.httpIntegration.getHttpInstrumentationOptions()). What do you think about that?

@mydea
Copy link
Member Author

mydea commented Sep 19, 2024

Don't we have to re-export getHttpInstrumentationOptions in the metaframeworks as well?

It's a little annoying that we have to put getHttpInstrumentationOptions in the top level namespace, but I guess not a good way to go around this unless we add another field to httpIntegration (like Sentry.httpIntegration.getHttpInstrumentationOptions()). What do you think about that?

My reasoning was that as of now we don't really care (and/or support) custom otel setups for the meta frameworks (yet), so it's not necessary to re-export this there - but no strong feelings about this!

I also agree that it would be nice to group this somewhere, but I also always find it a bit counter intuitive to have props like this on functions 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants