Skip to content

Ignore a deprecation warning from sentry_sdk #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

seanh
Copy link
Member

@seanh seanh commented Feb 14, 2025

As of its 2.21.0 release sentry_sdk's Celery integration has begun emitting this deprecation warning:

E       DeprecationWarning: The `propagate_traces` parameter is deprecated. Please use `trace_propagation_targets` instead.

.tox/tests/lib/python3.12/site-packages/sentry_sdk/integrations/celery/__init__.py:73: DeprecationWarning

h-pyramid-sentry doesn't actually use the propagate_traces parameter. In fact all it's doing is inititalising sentry_sdk's Celery integration with no arguments:

from sentry_sdk.integrations.celery import CeleryIntegration
init_options["integrations"].append(CeleryIntegration())

sentry_sdk appears to emit the warning unconditionally whenever anyone uses the Celery integration:

class CeleryIntegration(Integration):
    identifier = "celery"
    origin = f"auto.queue.{identifier}"

    def __init__(
        self,
        propagate_traces=True,
        monitor_beat_tasks=False,
        exclude_beat_tasks=None,
    ):
        # type: (bool, bool, Optional[List[str]]) -> None
        warnings.warn(
            "The `propagate_traces` parameter is deprecated. Please use `trace_propagation_targets` instead.",
            DeprecationWarning,
            stacklevel=2,
        )

The warning was added by this PR: getsentry/sentry-python#3899.

Just ignore the warning, as there's no way for us to fix this.

As of its [2.21.0
release](https://github.com/getsentry/sentry-python/releases/tag/2.21.0)
`sentry_sdk`'s Celery integration has begun emitting this deprecation
warning:

    E       DeprecationWarning: The `propagate_traces` parameter is deprecated. Please use `trace_propagation_targets` instead.

    .tox/tests/lib/python3.12/site-packages/sentry_sdk/integrations/celery/__init__.py:73: DeprecationWarning

h-pyramid-sentry doesn't actually use the `propagate_traces` parameter.
In fact all it's doing is inititalising `sentry_sdk`'s Celery
integration with no arguments:

    from sentry_sdk.integrations.celery import CeleryIntegration

    init_options["integrations"].append(CeleryIntegration())

https://github.com/hypothesis/h-pyramid-sentry/blob/6de9124faa29ca99979bc08318af7c45e0487586/src/h_pyramid_sentry/__init__.py#L54-L56

`sentry_sdk` appears to emit the warning unconditionally whenever anyone
uses the Celery integration:

    class CeleryIntegration(Integration):
        identifier = "celery"
        origin = f"auto.queue.{identifier}"

        def __init__(
            self,
            propagate_traces=True,
            monitor_beat_tasks=False,
            exclude_beat_tasks=None,
        ):
            # type: (bool, bool, Optional[List[str]]) -> None
            warnings.warn(
                "The `propagate_traces` parameter is deprecated. Please use `trace_propagation_targets` instead.",
                DeprecationWarning,
                stacklevel=2,
            )

https://github.com/getsentry/sentry-python/blob/25ddbcad9642cf38b7a9668e348f80fb9b1c892e/sentry_sdk/integrations/celery/__init__.py#L62-L77

The warning was added by this PR: getsentry/sentry-python#3899.

Just ignore the warning, as there's no way for us to fix this.
@seanh seanh requested a review from marcospri February 14, 2025 10:17
@@ -0,0 +1 @@
"ignore:The `propagate_traces` parameter is deprecated\\. Please use `trace_propagation_targets` instead\\.:DeprecationWarning:",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to limit this filter to a path, for example:

"ignore:The `propagate_traces` parameter is deprecated\\. Please use `trace_propagation_targets` instead\\.:DeprecationWarning:sentry_sdk.integrations.celery",

...but I can't seem to get it to work. Only omitting the path entirely seems to work 🤷

@seanh seanh merged commit 4dd45f1 into main Feb 14, 2025
13 checks passed
@seanh seanh deleted the filter-sentry_sdk-deprecation-warning branch February 14, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants