Add tracing to `DramatiqIntegration`
How do you use Sentry?
Self-hosted/on-premise
Version
2.13.0
Steps to Reproduce
- Follow the instructions on https://docs.sentry.io/platforms/python/integrations/dramatiq/ for using the
DramatiqIntegration - Enable tracing and profiling
Additional context: I know https://github.com/getsentry/sentry-python/pull/3397 was recently released and this is most likely happening because that integration is only capturing events from exceptions, but the documentation still states that it is just a matter of enabling tracing or profiling.
Would be amazing to have tasks instrumented automatically, but maybe a temporary warning in the dramatiq integration docs to make it explicit that it doesn't work without manual instrumentation.
Expected Result
Dramatiq actors tracing and profiling appear in performance and profiling sections of Sentry without manual instrumentation
Actual Result
Dramatiq actors tracing and profiling do not appear in performance and profiling sections of Sentry
Hi @ramonsaraiva, it indeed appears that the DramatiqIntegration does not support tracing/profiling; the docs page is incorrect.
I opened a separate issue to make sure we update our docs page.
Additionally, I renamed this issue to "Add tracing to DramatiqIntegration" and will place it on our backlog. We are busy with larger projects at the moment, so it might take us some time to get around to adding tracing to the Dramatiq integration. If you (or anyone else from the community) would like, please feel free to contribute a PR to add this functionality. We are happy to help with reviews.
separate issue
@szokeasaurusrex Is there a guideline or docs explaining how this could be implemented, I am happy to give it a shot.
Hey @wsantos, the separate issue that you are referencing was the issue to update our docs to state that Dramatic does not support tracing, and I have already completed this.
Are you instead wondering about how to add tracing to Dramatiq, which would solve this issue? If so, we have some SDK Development Docs, but I don't think these cover how to write a tracing integration (perhaps this is something we can add). My recommendation is to take a look at the source code for other integrations which do have tracing and base your implementation on that. You can feel free to reach out to us if you get stuck anywhere
I added a link to the relevant custom instrumentation docs in our dramatiq docs: https://github.com/getsentry/sentry-docs/pull/11224
Hey @wsantos, the separate issue that you are referencing was the issue to update our docs to state that
Dramaticdoes not support tracing, and I have already completed this.Are you instead wondering about how to add tracing to Dramatiq, which would solve this issue? If so, we have some SDK Development Docs, but I don't think these cover how to write a tracing integration (perhaps this is something we can add). My recommendation is to take a look at the source code for other integrations which do have tracing and base your implementation on that. You can feel free to reach out to us if you get stuck anywhere
Correct, I'd like to know how to add it, I'm going to try it if I can find some spare time.
Correct, I'd like to know how to add it, I'm going to try it if I can find some spare time.
Okay, understood. As I mentioned previously, I don't think we have any docs specifically about how to develop tracing integrations. The custom instrumentation docs might be helpful though; these docs describe how to instrument your app with tracing manually. The page is more oriented towards application developers wishing to instrument something lacking a tracing-compatible integration in their app, but the same concepts will likely apply when creating the integration.
As for how to patch Dramatiq to gather the appropriate tracing information, I would take a look at the source code of our other integrations. Which parts of Dramatiq you patch is going to depend on how Dramatiq is written (since I am not familiar with Dramatiq, I unfortunately cannot help much here).
My try to solve the issue. I can confirm that tracing is working now (checked on real project) but review is strongly required)