Can I disable Auto-Propagation for specific outgoing HTTP requests? #4413
Replies: 1 comment
-
Figured it out!!! Example solution for only adding context for requests going to const sdk = new NodeSDK({
instrumentations: [getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-http': {
ignoreOutgoingRequestHook: (requestOptions) => {
return requestOptions.hostname ? !requestOptions.hostname.includes('my-own-infrastructure.com') : true;
},
},
})],
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, my NodeJS app makes calls using HTTP to other microservices of my own but also to third party APIs. I don't want to add the
Traceparent
header to the requests that are leaving my infrastructure. Is there a way to use auto-instrumentation for all requests except a specific one? Alternatively, can I have an allow/deny-list per domain?Edit: I see it is possible using ignoreOutgoingUrls, but it is deprecated. Why? 😭
Edit2: Apparently it was replaced with a general hook. But where are the docs for that?
Edit3: Looks like the hook I need is
ignoreOutgoingRequestHook
and even though I can not find docs directly there is someone with sample code and we also have type definitionsBeta Was this translation helpful? Give feedback.
All reactions