Skip to content
101 changes: 5 additions & 96 deletions docs/platforms/python/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,7 @@ This guide focuses on plain Python. If you're working with Django, FastAPI, Star

## Install

<SplitLayout>
<SplitSection>
<SplitSectionText>

Run the command for your preferred package manager to add the Sentry SDK to your application:

</SplitSectionText>
<SplitSectionCode>

```bash {tabTitle:pip}
pip install "sentry-sdk"
```

```bash {tabTitle:uv}
uv add "sentry-sdk"
```

```bash {tabTitle:poetry}
poetry add "sentry-sdk"
```

</SplitSectionCode>
</SplitSection>
</SplitLayout>
<PlatformContent includePath="getting-started-install" />

## Configure

Expand Down Expand Up @@ -174,11 +151,7 @@ def some_function():

Let's test your setup and confirm that data reaches your Sentry project.

<Alert level="warning">

Errors triggered from a Python shell like IPython will not trigger Sentry's error monitoring. Make sure you're running the examples from a file instead.

</Alert>
<Include name="python-quick-start-shell-warning.mdx" />

### Issues

Expand All @@ -203,83 +176,19 @@ division_by_zero = 1 / 0

<OnboardingOption optionId="performance">

### Tracing

<SplitLayout>
<SplitSection>
<SplitSectionText>

To test your tracing configuration, create a custom transaction and span:

</SplitSectionText>
<SplitSectionCode>

```py
import sentry_sdk

with sentry_sdk.start_transaction(op="task", name="Transaction Name"):
span = sentry_sdk.start_span(name="Custom Span Name")
span.finish()
```

</SplitSectionCode>
</SplitSection>
</SplitLayout>
<Include name="tracing/python-quick-start-verify-tracing-splitlayout.mdx" />

</OnboardingOption>

<OnboardingOption optionId="logs">

### Logs

<SplitLayout>
<SplitSection>
<SplitSectionText>

To verify that Sentry catches your logs (which are enabled by default), add some log statements to your application:

</SplitSectionText>
<SplitSectionCode>

```py
import sentry_sdk

sentry_sdk.logger.info("This is an info log message")
sentry_sdk.logger.warning("This is a warning message")
sentry_sdk.logger.error("This is an error message")
```

</SplitSectionCode>
</SplitSection>
</SplitLayout>
<Include name="logs/python-quick-start-verify-logs-splitlayout.mdx" />

</OnboardingOption>

<OnboardingOption optionId="metrics">

### Metrics

<SplitLayout>
<SplitSection>
<SplitSectionText>

Send test metrics from your app to verify metrics are arriving in Sentry:

</SplitSectionText>
<SplitSectionCode>

```py
from sentry_sdk import metrics

metrics.count("checkout.failed", 1)
metrics.gauge("queue.depth", 42)
metrics.distribution("cart.amount_usd", 187.5)

```

</SplitSectionCode>
</SplitSection>
</SplitLayout>
<Include name="metrics/python-quick-start-verify-metrics-splitlayout.mdx" />

</OnboardingOption>

Expand Down
Loading
Loading