Troubleshooting

Learn how to troubleshoot your tracing setup.

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

When Sentry captures transactions, they are assigned a transaction 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 transaction generation (or want to customize how transaction names are generated) you can use the scope API to set transaction names or use a custom event processor.

For example, to set a transaction name:

Copied
import sentry_sdk

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

To use an event processor to modify transaction names:

Copied
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

def transaction_processor(event, hint):
    if event.get("type") == "transaction":
        # Extract path from transaction name
        transaction_name = event.get("transaction", "")
        
        # Remove variable IDs from URLs to reduce cardinality
        if "/user/" in transaction_name:
            # Convert /user/123/ to /user/:id/
            import re
            event["transaction"] = re.sub(r'/user/\d+/', '/user/:id/', transaction_name)
    
    return event

sentry_sdk.init(
    dsn="your-dsn",
    integrations=[DjangoIntegration()],
    traces_sample_rate=1.0,
    # Add your event processor during SDK initialization
    before_send_transaction=transaction_processor,
)

Currently, every tag has a maximum character limit of 200 characters. Tags over the 200 character limit will become truncated, losing potentially important information. To retain this data, you can split data over several tags instead.

For example, a 200+ character tag like this:

https://empowerplant.io/api/0/projects/ep/setup_form/?user_id=314159265358979323846264338327&tracking_id=EasyAsABC123OrSimpleAsDoReMi&product_name=PlantToHumanTranslator&product_id=161803398874989484820458683436563811772030917980576

...will become truncated to:

https://empowerplant.io/api/0/projects/ep/setup_form/?user_id=314159265358979323846264338327&tracking_id=EasyAsABC123OrSimpleAsDoReMi&product_name=PlantToHumanTranslator&product_id=1618033988749894848

Instead, using span.set_tag and span.set_data preserves the details:

Copied
import sentry_sdk

# ...

base_url = "https://empowerplant.io"
endpoint = "/api/0/projects/ep/setup_form"
parameters = {
    "user_id": 314159265358979323846264338327,
    "tracking_id": "EasyAsABC123OrSimpleAsDoReMi",
    "product_name": "PlantToHumanTranslator",
    "product_id": 161803398874989484820458683436563811772030917980576,
}

with sentry_sdk.start_span(op="request", transaction="setup form") as span:
    span.set_tag("base_url", base_url)
    span.set_tag("endpoint", endpoint)
    span.set_data("parameters", parameters)
    make_request(
        "{base_url}/{endpoint}/".format(
            base_url=base_url,
            endpoint=endpoint,
        ),
        data=parameters
    )

    # ...
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").