-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix: Update JS Docs #1556
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: Update JS Docs #1556
Conversation
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
], | ||
tracesSampleRate: 0.1, |
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.
@HazAT Just curious, is this the preferred placement of the configuration? Wondering because of https://github.com/getsentry/sentry/blob/3672ca751d9306fc22761f1a52847787fcef7915/src/sentry/static/sentry/app/bootstrap.jsx#L37-L40
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.
This will be fixed in the next update, should have never been there in the first place.
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. Thanks for clarifying 👍
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
@@ -280,7 +316,7 @@ const Apm = require("@sentry/apm"); // This is required since it patches functio | |||
|
|||
Sentry.init({ | |||
dsn: "___PUBLIC_DSN___", | |||
tracesSampleRate: 0.1 | |||
tracesSampleRate: 1 |
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.
Why change it to 1
?
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.
Daniel, we cannot allow anybody to send 100% of their traffic to us. This burns immediately through their quota as long as the new billing is not live.
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 leave it in the responsibility of the user to set the correct value here.
1 = they see it works
0.1 = they write into support it's not working
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.
Okay, can we then add a comment here that they should be careful in increasing this towards 1 in prod? 1 makes total sense in dev.
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.
FWIW this is also inconsistent with other code examples.
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.
can we then add a comment here that they should be careful in increasing this towards 1 in prod? 1 makes total sense in dev.
+1
Maybe nobody cares, but I would also find 1.0
more indicative that this is not a 0
or 1
setting, but that typical values are floats in the [0.0, 1.0] range: 0.0
, 0.1
, 0.25
...
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.
@HazAT
maybe keep it at 1.0 but then put a comment before or after the code snippet that says,
"We recommend 0.1 for when you put this to production [because...]"
maybe keep it at 0.1 but then put a comment before or after the code snippet that says,
"You may want this on 1.0 if you're testing it for the first time"
"You may want this on 1.0 if you're testing it for the first time or else you might think your transactions aren't coming through"
you're 100% correct about them writing into support, as I tricked myself on this the first time I set it up, and then again a month later when I re-visisted it. So that makes me prefer to see it at 1.0 by default.
Co-Authored-By: Rodolfo Carvalho <[email protected]>
Co-Authored-By: Rodolfo Carvalho <[email protected]>
…cs into performance/sampling
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.
Thanks for adding this! A few suggestions.
- Your frontend is running `mywebapp.com` | ||
- Your backend is running `api.mybackend.com` | ||
- You setup your frontend to make API calls to `api.mybackend.com` | ||
- Then the option need to be configured like this `new ApmIntegrations.Tracing({tracingOrigins: ['localhost', /^\//, 'api.mybackend.com']})` |
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.
What's the /^\//
for in this case?
Also, I'd not include localhost
, because what's the point of sending the header to localhost
(the page visitor's loopback device). Users may need to arrange for this config to have different values depending on environment.
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 would suggest only adding a new bullet point before this one without changing the code sample:
- In development, your API is at `localhost`
To explain what the localhost
is needed for. Then they can make an informed choice on which values to include in their config
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.
The choice of hosts is very env specific. If you're developing on local containers, localhost
is probably the wrong value. We can't know what the right value is for everyone, but we can explain what it needs to match and how to detect errors/ fix it.
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.
@rhcarvalho I think
it's for checking that the string 'localhost' is validated or not by the regex /^// ?
check out the function isMatchingPattern in string.ts
// tracing.ts
const isWhitelisted = self._options.tracingOrigins.some((origin: string | RegExp) =>
isMatchingPattern(url, origin),
);
looks like you can also write ['localhost', 'string']?
// string.ts
export function isMatchingPattern(value: string, pattern: RegExp | string): boolean {
if (isRegExp(pattern)) {
return (pattern as RegExp).test(value);
}
if (typeof pattern === 'string') {
return value.includes(pattern);
}
return false;
}
but i'm a little confused because:
reg = /^\//
reg.test('foobar')
false
reg.test('foo/bar')
false
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.
@rhcarvalho nevermind, the regex is checking that the string doesn't begin with a forward slash.
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
Co-Authored-By: Rodolfo Carvalho <[email protected]>
// When we pop the activity, the Integration will finish the span and after the timeout finish the transaction and send it to Sentry | ||
Integrations.ApmIntegrations.popActivity(activity); | ||
// Keep in mind, as long as you do not pop the activity, the transaction will be kept alive and not sent to Sentry |
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 ended up with two sentences that perhaps could be combined together to better convey the important information? ("When we pop... send it to Sentry" & "Keep in mind, ... sent to Sentry")
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
// Let's say this function is invoked when a user clicks on the checkout button of your shop | ||
shopCheckout() { | ||
// This will create a new Transaction for you | ||
ApmIntegrations.Tracing.startIdleTransaction('shopCheckout'); |
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.
Why here we use ApmIntegrations.Tracing.startIdleTransaction
instead of hub.startSpan
?
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.
Because we prefer ppl using the Integration over the startSpan
The integration also adds spans for XHR/fetch
src/collections/_documentation/performance/distributed-tracing.md
Outdated
Show resolved
Hide resolved
const activity = ApmIntegrations.Tracing.pushActivity('task', { | ||
data: { | ||
result | ||
}, | ||
op: 'task', |
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.
Why do we need a name
(first arg) for an Activity? Why would people need to write an activity name and then op
(which is also some sort of activity/operation name)?!
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.
It's there if you want to have an activity that is "blocking" the idle transaction but you do not want to create a span out of it.
Co-Authored-By: Rodolfo Carvalho <[email protected]>
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.
Looks good to me 👍
No description provided.