Sentry traces_sampler(sampling_context) how to use with fast api

In sentry docs there is example

https://docs.sentry.io/platforms/python/configuration/sampling/

def traces_sampler(sampling_context):
    # Examine provided context data (including parent decision, if any)
    # along with anything in the global namespace to compute the sample rate
    # or sampling decision for this transaction

    if "...":
        # These are important - take a big sample
        return 0.5
    else:
        # Default sample rate
        return 0.1

sentry_sdk.init(
    # ...

    traces_sampler=traces_sampler,
)

but there are no typing for sampling_context variable, I have no idea how to filter specific http route in case of FastAPI integration.

Pls advice how to set different sample rate for specific route ?



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)