---
title: "Troubleshooting"
description: "Learn how to troubleshoot your tracing setup."
url: https://docs.sentry.io/platforms/python/tracing/troubleshooting/
---

# Tracing Troubleshooting for Python

If you need help managing spans, you can read more here. If you need additional help, you can ask on GitHub. Customers on a paid plan may also contact support.

This page describes tracing troubleshooting for version `3.x` of the Python SDK. For `2.x`, switch to `2.x` in the version selector.

## [Group Service Spans](https://docs.sentry.io/platforms/python/tracing/troubleshooting.md#group-service-spans)

When Sentry captures a service span, it's assigned a name. This name is generally auto-generated by the Sentry SDK based on the framework integrations you are using. If you can't leverage the automatic naming (or want to customize how service span names are generated), you can use the scope API to set the name or modify it in a `before_send_span` callback.

For example, to set the name of the current service span:

```python
import sentry_sdk

# Setting the service span name directly on the current scope
scope = sentry_sdk.get_current_scope()
scope.set_transaction_name("UserListView")
```

You can define a custom `before_send_span` callback to modify span names:

```python
import re

import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

def span_processor(span, hint):
    if span.get("is_segment"):
        # Remove variable IDs from URLs to reduce cardinality
        # Convert /user/123/ to /user/:id/
        span["name"] = re.sub(r"/user/\d+/", "/user/:id/", span["name"])

    return span

sentry_sdk.init(
    dsn="your-dsn",
    integrations=[DjangoIntegration()],
    traces_sample_rate=1.0,
    # Add your span processor during SDK initialization
    before_send_span=span_processor,
)
```

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
