Skip to content

[Bug] Sentry python sdk not working anymore #164

Open
@nayef-livio-derwiche

Description

@nayef-livio-derwiche

What are you really trying to do?

I was trying to use the sentry sdk sample but it does not work anymore because it indirectly uses the warning module.

Describe the bug

The with Hub(Hub.current) context manager triggers an import of the warning module because hub is being deprecated and there is an import-time warning about that.

I am not exactly sure why the passthrough is not enough, I just started using temporal :)

Minimal Reproduction

Use a sentry recent version (mine was 2.22.0)
Set up the sample, trigger a workflow.
It fails.

Additional context

I was able to fix by replacing with Hub(Hub.current) with with isolation_scope()

I wonder if to avoid future issue there is a way to handle some non-available lib in the sandbox directly? To have calling warnings for instance do nothing instead of failing ?

Activity

NorthIsUp

NorthIsUp commented on Mar 12, 2025

@NorthIsUp

I'm having the same issue an update to the sentry code, would temporal consider adding an officially supported integration instead of a recipe?

M0NsTeRRR

M0NsTeRRR commented on Mar 12, 2025

@M0NsTeRRR

Yes, same question. Having to copy/paste this Python file from the repo and update it when it breaks is a bit strange to manage. Would a contrib module with different extras like temporalio-contrib[sentry,pydantic] (etc.) be a better idea ? I posted it there after seeing @NorthIsUp’s comment, but maybe we should open a new issue for that .

cretz

cretz commented on Mar 17, 2025

@cretz
Member

We can discuss formal inclusion in the SDK though that is a bit of a larger ask. In the meantime, this sample was an external contribution and unfortunately did not have tests. So I think the best first step is to add tests to make sure it works and continues to work. We do have plans to address this issue hopefully soon (but we also accept PRs of course). EDIT: And we also need to move the workflow to its own file that does no sentry imports.

NorthIsUp

NorthIsUp commented on Mar 18, 2025

@NorthIsUp

@cretz appreciate that, temporal and sentry are both critical tools to our operational infrastructure and we would love for the two tool to play nice!

Natim

Natim commented on May 20, 2025

@Natim

If I understand correctly, the fix is to move the captureException code within an activity so that it is not tampered with the workflow_sandbox importer.

Had anyone have a look at #140 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @NorthIsUp@cretz@Natim@nayef-livio-derwiche@M0NsTeRRR

        Issue actions

          [Bug] Sentry python sdk not working anymore · Issue #164 · temporalio/samples-python