Skip to content

profiles_sample_rate as string causes Django to not bootstrap. #4294

Closed as not planned
@jreeter

Description

@jreeter

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.22.0

Steps to Reproduce

Set traces and profile rates to strings:

traces_sample_rate="1",
profiles_sample_rate="1",

Expected Result

For Django to bootstrap and run and/or for traces and profiles sample rates to either both accept strings or both fail, either way they should be consistent it seems.

Actual Result

To adjust profile and sample rates on the fly we add them to a centralized store as strings. However,
this surfaced an inconsistency, setting profiles_sample_rate as a string causes Django to not bootstrap.

Output

 File "/Users/jree/.pyenv/versions/3.11.4/envs/shepherd-3.11/lib/python3.11/site-packages/sentry_sdk/profiler/transaction_profiler.py", line 127, in has_profiling_enabled
    if profiles_sample_rate is not None and profiles_sample_rate > 0:
                                            ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'str' and 'int'

This only affects profiles_sample_rate, traces_sample_rate is not affected by this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions