-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(tracing): Pass tracePropagationTargets
to instrumentOutgoingRequests
#6259
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
Conversation
34d29e4
to
4d3e188
Compare
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.
Won't this be breaking instrumentOutgoingRequests
(we publicly export this function)
Hmm didn't know that we export this publicly. But would it really be breaking? We don't change the signature at all, we just don't take EDIT: Ok, sure if people still pass Out of curiosity, do you know why we expose this function? I couldn't find any usage of it in our SDKs |
So if someone passes in |
44e6617
to
a019a0a
Compare
Where does this option go? The docs don't give any context. |
Sentry.init({
// ...
integrations: [
new BrowserTracing({
tracePropagationTargets: ["api.example.com"],
}),
],
}); |
Thanks! The top 2 documentation results when you search for the
Also, I got screwed because I was passing in Should I submit another issue to fix those docs? |
This really, really screwed up our Beamer integration - a task which should have literally taken 1 minute ended up taking hours to figure out why their requests were being rejected. |
Sorry to hear the troubles - thanks for sharing your feedback, we'll make sure to do better here. Regarding the docs you linked.
It's important to note, Setting |
I was still on |
This import {
init as initSentry,
reactRouterV5Instrumentation,
} from "@sentry/react";
import { BrowserTracing } from "@sentry/tracing";
initSentry({
dsn: REACT_APP_SENTRY_DSN,
integrations: [
new BrowserTracing({
tracePropagationTargets: ["api.mydomain.com", "www.mydomain.com"],
routingInstrumentation: reactRouterV5Instrumentation(history),
}),
],
// Set tracesSampleRate to 1.0 to capture 100% of transactions.
// We recommend adjusting this value in production.
tracesSampleRate: 1.0,
}); And I still get error:
I can see in the devtools that Sentry is still adding the
|
As per the docs on
In this case, |
Thanks so much for your help @AbhiPrasad Looking at the docs' example while in the middle of triaging a frustrating issue where it says In other words - who would ever specify just Honestly, I was surprised after using Sentry for years that it's patching every request to begin with... I'm assuming that something like this will work and I'm going to test that in a few moments. I understand the full extent of the issue now and I just wanted to share my experience dealing with it as I sit here waiting for the CI/CD to deploy.... tracePropagationTargets: [
"https://api.mydomain.com",
"https://www.mydomain.com",
], |
It finally worked. I'm going to go rethink my life now. Thanks again!! |
I also asked to have this sent to Beamer so they can warn anyone using Sentry that it will be a real PITA to figure out if you've never dealt with these options before. |
Yup I understand why this can be confusing, we are going to take another look at evaluating this.
For performance monitoring we need to patch every request (that you allow in We do monkeypatch fetch/xhr for errors - but that doesn't mutate the outgoing headers. Thanks for being patient with us - apologies for the trouble caused! |
This PR fixes a bug in our
BrowserTracing
integration which caused the newtracePropagationTargets
option not to be passed toinstrumentOutgoingRequests
where it was needed to decide if our tracing headers should be attached to outgoing requests or not.Because we never passed this value to the instrumentation function, custom-defined
tracePropagationTargets
values were not respected by the SDK and headers were attached to requests whose URLs matched the default targets or custom specifiedtracingOrigins
.With this PR, we also make a change how we internally handle the co-existance between the deprecated
tracingOrigins
andtracePropagationTargets
options. We now simply overwrite the defaulttracePropagationTargets
values with customtracingOrigins
(if available and no customtracePropagationTargets
were set). This enables us to internally only rely ontracePropagationTargets
.Note that we still have to keep setting
tracingOrigins
tobrowserTracing.options
, as removing this field or changing the type would break users. This field however is not used internally anymore.This PR also adds a bunch of unit and integration tests to make sure,
tracePropagationTargets
works as expected this time. Also, the tests check thattracingOrigins
is still respected properly.fixes #6077