Skip to content
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

Merged
merged 5 commits into from
Nov 28, 2017
Merged

[core] add SyncWriter #252

merged 5 commits into from
Nov 28, 2017

Conversation

p-lambert
Copy link
Member

@p-lambert p-lambert commented Nov 17, 2017

Overview

Adds a sync writer so that no threads are used to flush data. This means that when the Tracer finishes a trace (calling the write() 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.

@palazzem palazzem self-requested a review November 20, 2017 10:48
@palazzem palazzem added the core Involves Datadog core libraries label Nov 21, 2017
@palazzem palazzem added this to the 0.10.0 milestone Nov 21, 2017
proc { flush_trace(trace) }
)
rescue => e
Tracer.log.error(e)
Copy link
Contributor

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
Copy link
Contributor

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

@palazzem palazzem changed the title Add SyncWriter [core] add SyncWriter Nov 23, 2017
@@ -3,6 +3,11 @@ module Contrib
module Resque
SERVICE = 'resque'.freeze

class << self
# Globally-acccesible reference for pre-forking optimization
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@palazzem palazzem merged commit 71f7ad0 into master Nov 28, 2017
@palazzem palazzem deleted the pedro/add-sync-writer branch November 28, 2017 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants