Skip to content

Commit 4a3d732

Browse files
Shannon AnahataShannon Anahata
authored andcommitted
updates based on PR feedback
1 parent d6e2490 commit 4a3d732

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

docs/platforms/python/tracing/configure-sampling/index.mdx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ description: "Learn how to configure sampling in your app."
44
sidebar_order: 30
55
---
66

7-
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.
7+
Sentry's tracing functionality helps you monitor application performance by capturing distributed traces, attaching attributes, and adding span performance metrics 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.
8+
9+
Effective sampling is key to getting the most value from Sentry's performance monitoring while minimizing overhead. The `traces_sampler` function gives you precise control over which transactions to record, allowing you to focus on the most important parts of your application.
810

911
## Sampling Configuration Options
1012

1113
The Python SDK provides two main options for controlling the sampling rate:
1214

1315
1. Uniform Sample Rate (`traces_sample_rate`)
16+
1417
This option sets a fixed percentage of transactions to be captured:
1518

1619
<PlatformContent includePath="/performance/traces-sample-rate" />
@@ -196,7 +199,7 @@ sentry_sdk.init(
196199

197200
## The Sampling Context Object
198201

199-
When the `traces_sampler` function is called, it receives a `sampling_context` object with valuable information to help make sampling decisions:
202+
When the `traces_sampler` function is called, the Sentry SDK passes a `sampling_context` object with information from the relevant span to help make sampling decisions:
200203

201204
```python
202205
{
@@ -282,8 +285,4 @@ message = {
282285
queue.send(json.dumps(message))
283286
```
284287

285-
## Conclusion
286-
287-
Effective sampling is key to getting the most value from Sentry's performance monitoring while minimizing overhead. The `traces_sampler` function gives you precise control over which transactions to record, allowing you to focus on the most important parts of your application.
288-
289288
By implementing a thoughtful sampling strategy, you'll get the performance insights you need without overwhelming your systems or your Sentry quota.

docs/platforms/python/tracing/instrumentation/index.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ In Python, spans are typically created using a context manager, which automatica
2626
```python
2727
import sentry_sdk
2828

29+
# Start a span for a task
2930
with sentry_sdk.start_span(op="task", name="Create User"):
3031
# Your code here
3132
# The span will automatically end when exiting this block
33+
user = create_user(email="[email protected]")
34+
send_welcome_email(user)
35+
# The span automatically ends here when the 'with' block exits
3236
```
3337

3438
Alternatively, you can create spans manually and control their lifecycle yourself, which gives you more flexibility but also more responsibility:
@@ -41,6 +45,8 @@ try:
4145
# Your code here
4246
finally:
4347
# Remember to always end your spans
48+
# If you don't call span.finish(), the span will remain open indefinitely,
49+
# causing memory leaks and incorrect timing data
4450
span.finish()
4551
```
4652

@@ -177,7 +183,7 @@ See <PlatformLink to="/tracing/distributed-tracing/">Distributed Tracing</Platfo
177183

178184
### Adding Span Attributes
179185

180-
You can capture additional context with span attributes. These can be key-value pairs of various Python types:
186+
Span attributes customize information you can get through tracing. This information can be found in the traces views in Sentry, once you drill into a span. You can capture additional context with span attributes. These can be key-value pairs of various Python types.
181187

182188
```python
183189
import sentry_sdk

redirects.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -988,12 +988,16 @@ const userDocsRedirects = [
988988
destination: '/platforms/kotlin/guides/kotlin-multiplatform/:path*',
989989
},
990990
{
991-
source: '/platforms/python/:productfeature/troubleshooting/:path*',
992-
destination: '/platforms/python/troubleshooting/:path*',
993-
},
994-
{
995-
source: '/platforms/python/guides/:guide/troubleshooting/:path*',
996-
destination: '/platforms/python/troubleshooting/:path*',
991+
source: '/platforms/python/:productfeature/troubleshooting/:path*',
992+
destination: '/platforms/python/troubleshooting/:path*',
993+
},
994+
{
995+
source: '/platforms/python/guides/:guide/troubleshooting/:path*',
996+
destination: '/platforms/python/troubleshooting/:path*',
997+
},
998+
{
999+
source: '/platforms/python/tracing/trace-propagation/:path*',
1000+
destination: '/platforms/python/tracing/distributed-tracing/:path*',
9971001
},
9981002
{
9991003
source: '/platforms/ruby/guides/:guide/:productfeature/troubleshooting/:path*',

0 commit comments

Comments
 (0)