Skip to content

Commit d2a9683

Browse files
committed
Merge branch 'master' of github.com:getsentry/sentry-docs into smi/quick-start/react-manual-tracing
2 parents 9a1bff2 + 5b1463f commit d2a9683

File tree

70 files changed

+2177
-593
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2177
-593
lines changed

develop-docs/backend/application-domains/options.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,13 @@ If you expect to frequently update your option, you can make it editable in the
6969
If you're working on a system-wide feature, you may choose to use options for your rollout instead of feature flags. Unlike feature flags, options don't allow for easy segmentation, but they are performant, stable, and simple to implement. e.g.,
7070

7171
```python
72-
import random
73-
from sentry import options
72+
from sentry.options.rollout import in_random_rollout
7473

75-
rate = options.get("performance.some-feature-rate")
76-
if rate > random.random():
74+
if in_random_rollout("performance.some-feature-rate"):
7775
do_feature_stuff()
7876
```
7977

80-
However, be careful! Using `random.random` will cause your feature to be enabled and disabled randomly between page requests. This may be unacceptable for user-facing features. To avoid this, you can use the `sample_modulo` helper. e.g.,
78+
However, be careful! `in_random_rollout` uses `random.random` under the hood, and will cause your feature to be enabled and disabled randomly between page requests. This may be unacceptable for user-facing features. To avoid this, you can use the `sample_modulo` helper. e.g.,
8179

8280
```python
8381
from sentry.utils.options import sample_modulo

docs/concepts/key-terms/tracing/span-metrics.mdx

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,17 @@ By attaching attributes directly to spans, you create a unified view of both the
2020
// Simple database query with dynamic attributes
2121
Sentry.startSpan(
2222
{
23-
name: 'Database Query',
24-
op: 'db.query'
23+
name: "Database Query",
24+
op: "db.query",
2525
},
26-
() => {
27-
// Get active span to set attributes as data becomes available
28-
const span = Sentry.getActiveSpan();
29-
26+
(span) => {
3027
// Execute query and add results to span
31-
const result = executeQuery('SELECT * FROM users WHERE active = true');
32-
28+
const result = executeQuery("SELECT * FROM users WHERE active = true");
29+
3330
// Set attributes with the results data
34-
if (span) {
35-
span.setAttribute('db.rows_returned', result.length);
36-
span.setAttribute('db.execution_time_ms', result.executionTime);
37-
}
38-
31+
span.setAttribute("db.rows_returned", result.length);
32+
span.setAttribute("db.execution_time_ms", result.executionTime);
33+
3934
return result;
4035
}
4136
);
@@ -55,14 +50,14 @@ By integrating these attributes into tracing, you can maintain a single telemetr
5550
// Adding business context to a payment processing span
5651
Sentry.startSpan(
5752
{
58-
name: 'Process Payment',
59-
op: 'payment.process',
53+
name: "Process Payment",
54+
op: "payment.process",
6055
attributes: {
61-
'payment.amount': 99.99,
62-
'payment.currency': 'USD',
63-
'payment.method': 'credit_card',
64-
'customer.type': 'returning'
65-
}
56+
"payment.amount": 99.99,
57+
"payment.currency": "USD",
58+
"payment.method": "credit_card",
59+
"customer.type": "returning",
60+
},
6661
},
6762
async () => {
6863
// Payment processing implementation
@@ -91,12 +86,12 @@ Augment automatically-created or manually-defined spans with additional attribut
9186
const span = Sentry.getActiveSpan();
9287
if (span) {
9388
// User context
94-
span.setAttribute('user.subscription_tier', 'premium');
95-
89+
span.setAttribute("user.subscription_tier", "premium");
90+
9691
// Multiple metrics in a single operation
9792
span.setAttributes({
98-
'memory.heap_used': 1024000,
99-
'processing.total_steps': 5
93+
"memory.heap_used": 1024000,
94+
"processing.total_steps": 5,
10095
});
10196
}
10297
```
@@ -109,16 +104,16 @@ Create spans specifically for grouping related attributes or metrics, particular
109104
// Creating a span for monitoring external API usage
110105
Sentry.startSpan(
111106
{
112-
name: 'Third-Party API Usage',
113-
op: 'external.api',
107+
name: "Third-Party API Usage",
108+
op: "external.api",
114109
attributes: {
115110
// Performance metrics
116-
'api.response_time_ms': 245,
117-
111+
"api.response_time_ms": 245,
112+
118113
// Context data
119-
'feature.using_api': 'image_recognition',
120-
'user.plan': 'enterprise'
121-
}
114+
"feature.using_api": "image_recognition",
115+
"user.plan": "enterprise",
116+
},
122117
},
123118
async () => {
124119
// API call implementation
@@ -138,15 +133,15 @@ Monitor client-side performance metrics related to user experience:
138133
// UI performance monitoring
139134
Sentry.startSpan(
140135
{
141-
name: 'Page Interaction',
142-
op: 'ui.interaction',
136+
name: "Page Interaction",
137+
op: "ui.interaction",
143138
attributes: {
144-
'ui.first_input_delay_ms': 24,
145-
'ui.time_to_interactive_ms': 320,
146-
'ui.frames_dropped': 0,
147-
'user.device_type': 'mobile',
148-
'feature.being_used': 'image_carousel'
149-
}
139+
"ui.first_input_delay_ms": 24,
140+
"ui.time_to_interactive_ms": 320,
141+
"ui.frames_dropped": 0,
142+
"user.device_type": "mobile",
143+
"feature.being_used": "image_carousel",
144+
},
150145
},
151146
async () => {
152147
// UI interaction handling
@@ -162,17 +157,17 @@ Track database performance characteristics and their impact on application behav
162157
// Database query monitoring
163158
Sentry.startSpan(
164159
{
165-
name: 'Product Search Query',
166-
op: 'db.query',
160+
name: "Product Search Query",
161+
op: "db.query",
167162
attributes: {
168-
'db.query_type': 'SELECT',
169-
'db.table': 'products',
170-
'db.execution_time_ms': 145,
171-
'db.rows_returned': 87,
172-
'db.index_used': 'product_category_idx',
173-
'business.search_term': 'winter jacket',
174-
'business.search_filters_applied': 3
175-
}
163+
"db.query_type": "SELECT",
164+
"db.table": "products",
165+
"db.execution_time_ms": 145,
166+
"db.rows_returned": 87,
167+
"db.index_used": "product_category_idx",
168+
"business.search_term": "winter jacket",
169+
"business.search_filters_applied": 3,
170+
},
176171
},
177172
async () => {
178173
// Database query execution
@@ -188,21 +183,21 @@ Monitor file handling operations across your application stack:
188183
// File processing monitoring
189184
Sentry.startSpan(
190185
{
191-
name: 'Process Uploaded Image',
192-
op: 'file.process',
186+
name: "Process Uploaded Image",
187+
op: "file.process",
193188
attributes: {
194189
// Technical metrics
195-
'file.size_bytes': 2500000,
196-
'file.type': 'image/jpeg',
197-
190+
"file.size_bytes": 2500000,
191+
"file.type": "image/jpeg",
192+
198193
// Processing metrics
199-
'processing.steps_completed': ['virus_scan', 'resize', 'compress'],
200-
'processing.total_time_ms': 850,
201-
194+
"processing.steps_completed": ["virus_scan", "resize", "compress"],
195+
"processing.total_time_ms": 850,
196+
202197
// Context data
203-
'feature.using_upload': 'user_avatar',
204-
'subscription.allows_hd': true
205-
}
198+
"feature.using_upload": "user_avatar",
199+
"subscription.allows_hd": true,
200+
},
206201
},
207202
async () => {
208203
// Image processing implementation
@@ -218,21 +213,21 @@ Monitor performance and reliability of third-party service interactions:
218213
// Payment gateway monitoring
219214
Sentry.startSpan(
220215
{
221-
name: 'Payment Gateway',
222-
op: 'payment.gateway',
216+
name: "Payment Gateway",
217+
op: "payment.gateway",
223218
attributes: {
224219
// Performance metrics
225-
'gateway.response_time_ms': 980,
226-
'gateway.retry_count': 0,
227-
220+
"gateway.response_time_ms": 980,
221+
"gateway.retry_count": 0,
222+
228223
// Transaction data
229-
'order.total_amount': 159.99,
230-
'order.items_count': 3,
231-
224+
"order.total_amount": 159.99,
225+
"order.items_count": 3,
226+
232227
// Service metrics
233-
'gateway.fee_amount': 4.50,
234-
'gateway.fee_percent': 0.029
235-
}
228+
"gateway.fee_amount": 4.5,
229+
"gateway.fee_percent": 0.029,
230+
},
236231
},
237232
async () => {
238233
// Payment gateway integration
@@ -255,6 +250,7 @@ Maintain consistent naming patterns following the format `category.metric_name`
255250
#### Data Type Selection
256251

257252
Choose appropriate data types for your metrics:
253+
258254
- Numeric values for measurements (`response_time_ms`: 250)
259255
- Boolean values for state indicators (`cache.hit`: true)
260256
- String values for categorical data (`user.subscription`: 'premium')
@@ -263,6 +259,7 @@ Choose appropriate data types for your metrics:
263259
#### Performance Considerations
264260

265261
Be mindful of the performance impact of collecting metrics, especially for high-volume operations:
262+
266263
- Consider implementing sampling for high-frequency operations
267264
- Prioritize metrics with the highest analytical value
268265
- Avoid redundant or closely correlated metrics
@@ -276,6 +273,7 @@ If you're currently using Sentry's standalone Metrics product, migrating to span
276273
- **Improved correlation**: Direct association between attributes, traces, and errors
277274

278275
Migration process:
276+
279277
1. Identify your current metric instrumentation points
280278
2. Locate corresponding spans in your application
281279
3. Transfer your metrics to span attributes

docs/organization/membership/index.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ Projects can only be accessed by that project's team(s). Team Admins, Org Manage
118118
Any Org Member can get access to a project by joining the team that's associated with that project. Once you've joined a project you'll also be able to edit [ownership rules](/product/issues/ownership-rules/) for that project.
119119

120120
### Adding New Members
121-
<Alert>
122-
This feature is currently only available for [Early Adopters](/organization/early-adopter-features/).
123-
</Alert>
124121

125122
Users with Manager and Owner-level permissions can add, remove, and change members for a project or organization. They can also toggle on the "Let Members Invite Others" setting to allow any org member to freely invite anyone they like without needing org owner or manager approval.
126123

docs/platforms/dotnet/common/configuration/options.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ Example scenarios where it should be explicitly set to true:
4949

5050
Defaults to `false`, unless in Blazor WASM, MAUI, Unity, or Xamarin where the default is `true`.
5151

52-
In server applications, when Global Mode is **disabled**, data stored in the scope is only available in the context of the particular request in which it is created.
52+
When Global Mode is **disabled** data stored in the scope is set on the current [ExecutionContext](https://learn.microsoft.com/en-us/dotnet/api/system.threading.executioncontext).
53+
In server applications data stored in the scope is only available in the context of the particular request in which it is created.
54+
Broadly, the ExecutionContext passes to child tasks and threads, but not to parent tasks and threads.
5355

54-
For UI applications (like MAUI) when Global mode is **enabled**, a single scope stack is shared by the whole application.
56+
When Global Mode is **enabled**, a single scope stack is shared by the whole application.
57+
58+
Since version 5.0.0 the transaction is always set on the current ExecutionContext, regardless of the Global Mode, so that spans from the UI don't get mixed up with transactions in background services.
5559

5660
See the <PlatformLink to="/enriching-events/scopes/">Scopes and Hubs documentation</PlatformLink> for more information.
5761

docs/platforms/javascript/common/apis.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ Sentry.setTag("tag", "value");
8686
},
8787
]}
8888
>
89-
Flushes all pending events and disables the SDK. Note that this does not
90-
remove any listeners the SDK may have set up.
89+
Flushes all pending events and disables the SDK. Note that this does not
90+
remove any listeners the SDK may have set up. After a call to `close`, the current client cannot be used anymore. It's
91+
important to only call `close` immediately before shutting down the application.
92+
93+
Alternatively, the [`flush`](#flush) method drains the event queue while keeping the
94+
client enabled for continued use.
95+
9196
</SdkApi>
9297

9398
<SdkApi

docs/platforms/javascript/common/configuration/draining.mdx

Lines changed: 0 additions & 10 deletions
This file was deleted.

docs/platforms/javascript/common/configuration/filtering.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,8 @@ Learn more about <PlatformLink to="/configuration/sampling/">configuring the sam
176176

177177
## Filtering Spans
178178

179-
Available since JavaScript SDK version `8.2.0`.
180-
181179
Use the <PlatformIdentifier name="before-send-span" /> configuration option which allows you to provide a function to modify a span.
182180
This function is called for the root span and all child spans. If you want to drop the root span, including its child spans, use [`beforeSendTransaction`](#using-beforesendtransaction) instead.
181+
Please note that you cannot use `beforeSendSpan` to drop a span, you can only modify it and filter data on it.
183182

184183
<PlatformContent includePath="configuration/before-send-span" />

docs/platforms/javascript/common/tracing/configure-sampling/index.mdx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ sidebar_order: 30
66

77
Sentry's tracing functionality helps you monitor application performance by capturing distributed traces, attaching attributes, and span performance across your application. However, Capturing traces for every transaction can generate significant volumes of data. Sampling allows you to control the amount of spans that are sent to Sentry from your application.
88

9-
## Sampling Configuration Options
10-
119
The JavaScript SDK provides two main options for controlling the sampling rate:
1210

13-
1. Uniform Sample Rate (`tracesSampleRate`)
11+
1. [Uniform Sample Rate](#uniform-sample-rate-tracessamplerate) (recommended)
12+
2. [Sampling Function](#sampling-function-tracessampler)
13+
14+
## Uniform Sample Rate (`tracesSampleRate`)
15+
1416
`tracesSampleRate` is floating point value 0.0 and 1.0, which controls the probability that a transaction will be sampled.
1517

1618
<PlatformContent includePath="/tracing/sample-rate" />
1719

1820
With `tracesSampleRate` set to `0.25`, each transaction in your application is randomly sampled with a probability of 25%, so you can expect that one in every four transactions will be sent to Sentry.
1921

20-
### Sampling Function (`tracesSampler`)
22+
## Sampling Function (`tracesSampler`)
2123

2224
For more granular control, you provide a `tracesSampler` function. This approach allows you to:
2325

@@ -36,16 +38,16 @@ When the `tracesSampler` function is called, it receives a `samplingContext` obj
3638
interface SamplingContext {
3739
// Name of the span/transaction
3840
name: string;
39-
41+
4042
// Initial attributes of the span/transaction
4143
attributes: SpanAttributes | undefined;
42-
44+
4345
// Whether the parent span was sampled (undefined if no incoming trace)
4446
parentSampled: boolean | undefined;
45-
47+
4648
// Sample rate from incoming trace (undefined if no incoming trace)
4749
parentSampleRate: number | undefined;
48-
50+
4951
// Utility function to inherit parent decision or fallback
5052
inheritOrSampleWith: (fallbackRate: number) => number;
5153
}
@@ -125,7 +127,7 @@ tracesSampler: (samplingContext) => {
125127
126128
When multiple sampling mechanisms could apply, Sentry follows this order of precedence:
127129
128-
- If `tracesSampler` is defined, its decision is used. Although the `tracesSampler` can override the parent sampling decision, most users will want to ensure their `tracesSampler` respects the parent sampling decision.
130+
- If `tracesSampler` is defined, its decision is used. Although the `tracesSampler` can override the parent sampling decision, most users will want to ensure their `tracesSampler` respects the parent sampling decision.
129131
- If no `tracesSampler` is defined, but there is a parent sampling decision from an incoming distributed trace, we use the parent sampling decision
130132
- If neither of the above, `tracesSampleRate` is used
131133
- If `tracesSampleRate` is set to 0, no spans will be sampled, and no downstream spans will be sampled either since they inherit the parent sampling decision
@@ -134,4 +136,3 @@ When multiple sampling mechanisms could apply, Sentry follows this order of prec
134136
## Conclusion
135137
136138
Effective sampling is key to getting the most value from Sentry's performance monitoring while minimizing overhead. The `tracesSampler` function gives you precise control over which transactions to record, allowing you to focus on the most important parts of your application.
137-

0 commit comments

Comments
 (0)