-
Notifications
You must be signed in to change notification settings - Fork 373
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
[core] add SyncWriter
#252
Conversation
lib/ddtrace/sync_writer.rb
Outdated
proc { flush_trace(trace) } | ||
) | ||
rescue => e | ||
Tracer.log.error(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can check if the regular writer has the same logging level
|
||
# Create SyncWriter instance before forking | ||
sync_writer = Datadog::SyncWriter.new(transport: pin.tracer.writer.transport) | ||
Datadog::SyncWriter::CACHED_INSTANCE = sync_writer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can move CACHED_INSTANCE
under the Resque namespace instead of the SyncWriter
@@ -3,6 +3,11 @@ module Contrib | |||
module Resque | |||
SERVICE = 'resque'.freeze | |||
|
|||
class << self | |||
# Globally-acccesible reference for pre-forking optimization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
149d802
to
cfd17b5
Compare
cfd17b5
to
81ec98a
Compare
Overview
Adds a sync writer so that no threads are used to flush data. This means that when the
Tracer
finishes a trace (calling thewrite()
method under the hood), the call is blocking. It's not meant to be used as a default tracer, but instead a good replacement in processes that forks and dies at the end (i.e. Resque).It reduces a lot the overhead since no signals / timeouts must be waited.