Skip to content

Commit

Permalink
Replace traces_sample_rate with enable_tracing (#8321)
Browse files Browse the repository at this point in the history
* Replace traces_sample_rate with enable_tracing, since backpressure management is now handled

* [getsentry/action-github-commit] Auto commit

* Apply suggestions from code review

Co-authored-by: Shana Matthews <[email protected]>

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Co-authored-by: Shana Matthews <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2023
1 parent 6afc594 commit be27b57
Show file tree
Hide file tree
Showing 55 changed files with 177 additions and 296 deletions.
2 changes: 1 addition & 1 deletion src/includes/opentelemetry-available.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Sentry can integrate with <strong>OpenTelemetry</strong>. You can find more
information about it{" "}
<PlatformLink to="/performance/instrumentation/opentelemetry/">
<strong>here</strong>
here
</PlatformLink>
.
</Alert>
6 changes: 1 addition & 5 deletions src/platform-includes/configuration/config-intro/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ sentry_sdk.init(
dsn="___PUBLIC_DSN___",
max_breadcrumbs=50,
debug=True,

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
enable_tracing=True,

# By default the SDK will try to use the SENTRY_RELEASE
# environment variable, or infer a git commit
Expand Down
6 changes: 2 additions & 4 deletions src/platform-includes/getting-started-config/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import sentry_sdk
sentry_sdk.init(
dsn="___PUBLIC_DSN___",

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production.
traces_sample_rate=1.0,
# Enable performance monitoring
enable_tracing=True,
)
```
16 changes: 2 additions & 14 deletions src/platform-includes/performance/configure-sample-rate/python.mdx
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
Performance Monitoring is available for the Sentry Python SDK version ≥ 0.11.2.
Activate performance monitoring by setting `enable_tracing` to `True`. Performance Monitoring is available for the Sentry Python SDK version ≥ 0.11.2.

<SignInNote />

```python
import sentry_sdk

def traces_sampler(sampling_context):
# ...
# return a number between 0 and 1 or a boolean

sentry_sdk.init(
dsn="___PUBLIC_DSN___",

# To set a uniform sample rate
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,

# Alternatively, to control sampling dynamically
traces_sampler=traces_sampler
enable_tracing=True
)
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import sentry_sdk

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
traces_sample_rate=1.0,
enable_tracing=True,

# set the instrumenter to use OpenTelemetry instead of Sentry
instrumenter="otel",
)
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions src/platform-includes/profiling/index/preface/go.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Note>

Go Profiling is currently in alpha. Alpha features are still in progress and may have bugs. We recognize the irony.

</Note>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Note>

React Native Profiling is currently in beta. Beta features are still in progress and may have bugs. We recognize the irony.

</Note>
5 changes: 5 additions & 0 deletions src/platform-includes/profiling/index/preface/ruby.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Note>

Ruby Profiling is currently in beta. Beta features are still in progress and may have bugs. We recognize the irony.

</Note>
12 changes: 9 additions & 3 deletions src/platforms/common/performance/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ Automatic instrumentation for monitoring the performance of your application is

</PlatformSection>

## Configure the Sample Rate
## Configure

<PlatformSection notSupported={["python"]}>
First, enable tracing and configure the sampling rate for transactions. Set the sample rate for your transactions by either:

- Setting a uniform sample rate for all transactions using the <PlatformIdentifier name="traces-sample-rate" /> option in your SDK config to a number between `0` and `1`. (For example, to send 20% of transactions, set <PlatformIdentifier name="traces-sample-rate" /> to `0.2`.)
- Controlling the sample rate based on the transaction itself and the context in which it's captured, by providing a function to the <PlatformIdentifier name="traces-sampler" /> config option.

The two options are meant to be mutually exclusive. If you set both, <PlatformIdentifier name="traces-sampler" /> will take precedence.

</PlatformSection>

<PlatformSection supported={["native"]}>

<Alert level="info">
Expand All @@ -86,8 +89,9 @@ The Native SDK doesn't currently support sampling functions (<PlatformIdentifier

<PlatformContent includePath="performance/configure-sample-rate" />

Learn more about how the options work in <PlatformLink to="/configuration/sampling/">Sampling Transactions</PlatformLink>.
Learn more about performance monitoring <PlatformLink to="/configuration/options/#tracing-options">options</PlatformLink>, or how to <PlatformLink to="/configuration/sampling/#sampling-transaction-events">sample transactions</PlatformLink>.

<PlatformSection notSupported={["python"]}>
## Verify

<PlatformSection supported={["react-native", "java.spring", "java.spring-boot", "android", "javascript", "apple", "dart", "rust"]}>
Expand Down Expand Up @@ -178,6 +182,8 @@ After you set up Relay, you should see a dramatic improvement to the impact on y

</PlatformSection>

**Next Steps:**
</PlatformSection>

## Next Steps

<PageGrid />
30 changes: 1 addition & 29 deletions src/platforms/common/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,7 @@ notSupported:
description: "Learn how to enable profiling in your app if it is not already set up."
---

<PlatformSection supported={["react-native"]}>

<Note>

React Native Profiling is currently in beta. Beta features are still in progress and may have bugs. We recognize the irony.

</Note>

</PlatformSection>

<PlatformSection supported={["go"]}>

<Note>

Go Profiling is currently in alpha. Alpha features are still in progress and may have bugs. We recognize the irony.

</Note>

</PlatformSection>

<PlatformSection supported={["ruby"]}>

<Note>

Ruby Profiling is currently in beta. Beta features are still in progress and may have bugs. We recognize the irony.

</Note>

</PlatformSection>
<PlatformContent includePath="profiling/index/preface" />

With [profiling](/product/profiling/), Sentry allows you to collect and analyze performance profiles from real user devices in production to give you a complete picture of how your application performs in a variety of environments.

Expand Down
2 changes: 2 additions & 0 deletions src/platforms/python/integrations/aiohttp/aiohttp-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ from sentry_sdk.integrations.aiohttp import AioHttpIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
# Enable performance monitoring
enable_tracing=True,
integrations=[
AioHttpIntegration(),
],
Expand Down
5 changes: 2 additions & 3 deletions src/platforms/python/integrations/aiohttp/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ import sentry_sdk

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
enable_tracing=True
)
```

Expand Down Expand Up @@ -85,6 +83,7 @@ from sentry_sdk.integrations.aiohttp import AioHttpIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
enable_tracing=True,
integrations=[
AioHttpIntegration(
transaction_style="method_and_path_pattern",
Expand Down
3 changes: 0 additions & 3 deletions src/platforms/python/integrations/ariadne/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ from sentry_sdk.integrations.ariadne import AriadneIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
integrations=[
AriadneIntegration(),
],
Expand Down
6 changes: 2 additions & 4 deletions src/platforms/python/integrations/arq/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ pip install --upgrade "sentry-sdk[arq]"

<SignInNote />

Add `ArqIntegration()` to your `integrations` list:
Add `ArqIntegration()` to your `integrations` list and make sure that tracing is enabled:

```python
import sentry_sdk
from sentry_sdk.integrations.arq import ArqIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
enable_tracing=True,
integrations=[
ArqIntegration(),
],
Expand Down
5 changes: 1 addition & 4 deletions src/platforms/python/integrations/asgi/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ from my_asgi_app import app

sentry_sdk.init(
dsn="___PUBLIC_DSN___",

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
enable_tracing=True
)

app = SentryAsgiMiddleware(app)
Expand Down
8 changes: 3 additions & 5 deletions src/platforms/python/integrations/asyncio/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: asyncio
description: "Learn about the asyncio integration and how it adds support for applications the asyncio module."
---

The `AsyncioIntegration` integrates with applications doing concurrent code execution using Pythons [asyncio](https://docs.python.org/3/library/asyncio.html) module.
The `AsyncioIntegration` integrates with applications doing concurrent code execution using Python's [asyncio](https://docs.python.org/3/library/asyncio.html) module.

## Install

Expand All @@ -13,7 +13,7 @@ pip install --upgrade 'sentry-sdk'

## Configure

Add `AsyncioIntegration()` to your list of `integrations` and be sure to call `sentry_sdk.init()` at the beginning of your async loop:
Add `AsyncioIntegration()` to your list of `integrations`, enable tracing and be sure to call `sentry_sdk.init()` at the beginning of your async loop:

<SignInNote />

Expand All @@ -24,9 +24,7 @@ from sentry_sdk.integrations.asyncio import AsyncioIntegration
async def main():
sentry_sdk.init(
dsn="___PUBLIC_DSN___",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
enable_tracing=True,
integrations=[
AsyncioIntegration(),
],
Expand Down
8 changes: 3 additions & 5 deletions src/platforms/python/integrations/asyncpg/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: asyncpg
description: "Learn about importing the asyncpg integration and how it captures queries from asyncpg."
---

The asyncpg integration captures queries from
The `AsyncPGIntegration` captures queries from
[asyncpg](https://github.com/MagicStack/asyncpg), which can be viewed in Sentry's **Performance** page.

## Install
Expand All @@ -16,7 +16,7 @@ pip install --upgrade sentry-sdk[asyncpg]

## Configure

Add `AsyncPGIntegration()` to your `integrations` list:
Add `AsyncPGIntegration()` to your `integrations` list, and enable tracing:

<SignInNote />

Expand All @@ -26,9 +26,7 @@ from sentry_sdk.integrations.asyncpg import AsyncPGIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=1.0,
enable_tracing=True,
integrations=[
AsyncPGIntegration(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ Set your image’s CMD value to the Sentry Handler:
CMD ["sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler"]
```

Also, set the following environment variables in AWS:
Next, set the following environment variables in AWS:

- Set `SENTRY_INITIAL_HANDLER` to the path of your function handler
- Set `SENTRY_DSN` to your Sentry DSN
- Set `SENTRY_TRACES_SAMPLE_RATE` to your preferred [sampling rate](/platforms/python/configuration/sampling/#sampling-transaction-events) for transactions

Alternatively, you can also set the environment variables in the Dockerfile:
Alternatively, you can also set the environment variables in your Dockerfile. Values set in AWS override the values in a Dockerfile if both are provided.

<SignInNote />

Expand All @@ -34,9 +34,3 @@ ENV SENTRY_INITIAL_HANDLER="<PATH_TO_FUNCTION_HANDLER>"
ENV SENTRY_DSN="___PUBLIC_DSN___"
ENV SENTRY_TRACES_SAMPLE_RATE="1.0"
```

<Note>

The values you set in AWS override the value in the Dockerfile if both are set.

</Note>
21 changes: 7 additions & 14 deletions src/platforms/python/integrations/aws-lambda/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
enable_tracing=True,
integrations=[
AwsLambdaIntegration(),
],

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
]
)

def my_function(event, context):
Expand All @@ -57,8 +53,7 @@ If you are using another web framework inside of AWS Lambda, the framework might

## Timeout Warning

The timeout warning reports an issue when the function execution time is near
the [configured timeout](https://docs.aws.amazon.com/lambda/latest/dg/configuration-console.html).
The timeout warning reports an issue when the function execution time is near the [configured timeout](https://docs.aws.amazon.com/lambda/latest/dg/configuration-console.html).

To enable the warning, update the SDK initialization to set `timeout_warning` to
`true`:
Expand All @@ -68,14 +63,12 @@ To enable the warning, update the SDK initialization to set `timeout_warning` to
```python
sentry_sdk.init(
dsn="___PUBLIC_DSN___",
enable_tracing=True,
integrations=[
AwsLambdaIntegration(timeout_warning=True),
AwsLambdaIntegration(
timeout_warning=True
),
],

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
)
```

Expand Down
10 changes: 3 additions & 7 deletions src/platforms/python/integrations/beam/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ redirect_from:
description: "Learn about using Sentry with Beam."
---

The Beam integration currently parses the functions in [ParDo](https://github.com/apache/beam/blob/release-2.13.0/sdks/python/apache_beam/transforms/core.py#L991) to return exceptions in their respective setup, start_bundle, process, and finish_bundle functions.
The Beam integration currently parses the functions in [ParDo](https://github.com/apache/beam/blob/release-2.13.0/sdks/python/apache_beam/transforms/core.py#L991) to return exceptions in their respective `setup`, `start_bundle`, `process`, and `finish_bundle` functions.

**This integration is experimental.** It may be removed in minor versions. When enabling this integration, expect to see incorrect server_name and ip due to some distributed properties within Beam.
**This integration is experimental.** It may be removed in minor versions. When enabling this integration, expect to see incorrect `server_name` and `ip` due to some distributed properties within Beam.

A Beam version of 2.12 or later is required.

Expand All @@ -21,14 +21,10 @@ from sentry_sdk.integrations.beam import BeamIntegration

sentry_sdk.init(
dsn="___PUBLIC_DSN___",
enable_tracing=True,
integrations=[
BeamIntegration(),
],

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
)
```

Expand Down
Loading

1 comment on commit be27b57

@vercel
Copy link

@vercel vercel bot commented on be27b57 Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev

Please sign in to comment.