-
Notifications
You must be signed in to change notification settings - Fork 375
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
Extract Writer from Tracer #1390
base: master
Are you sure you want to change the base?
Conversation
Thus far I have the core & its test suite updated. Tests for each integration still have to be updated, which is WIP. |
I'll be honest: This is a pretty big change and I don't feel at all confident that I can review it properly. Is there a way we can break this down into smaller steps perhaps? |
Despite the large number of files touched, the core changes to the core tracer components are surprisingly non-complex. |
@ivoanjo Totally understand how this PR can be overwhelming... it is a lot of lines changed. I think the more complicated part of all this is more in the test suite, which hopefully makes the operational code (in the lib) more manageable to review. I'm still trying to get all the tests to pass (having trouble with some expectations around tracer defaults implicitly written into some of the tests) but I will look for opportunities to simplify/split parts, if possible, to make it smaller. I might be able to do this with adding the subscription events, or some of the Minitest coverage that migrated into RSpec. Much of it will have to remain in one PR I suspect. |
(Removed myself for now otherwise this always shows up on my "reviews assigned to you list" -- do please re-add me when you start tackling this again :D ) |
Currently our
Datadog::Writer
lives insideDatadog::Tracer
. This has a few drawbacks:The goal of this PR is to decouple "tracing" from "writing", by creating a simple pub-sub event.
Datadog::Tracer
now triggers a:trace_completed
event with the trace that finished.Datadog::Writer
now subscribes to that event and ingests the trace for writing.Datadog::Writer
now triggers a:flush_completed
event with responses from agent.Datadog.tracer.sampler
now subscribes to that event and ingests the responses to update the priority sampler.This pattern has some nice benefits for the tracer overall: