Class: Datadog::Tracing::SyncWriter
- Inherits:
-
Object
- Object
- Datadog::Tracing::SyncWriter
- Defined in:
- lib/datadog/tracing/sync_writer.rb
Overview
SyncWriter flushes both services and traces synchronously DEV: To be replaced by Datadog::Tracing::Workers::TraceWriter.
Note: If you’re wondering if this class is used at all, since there are no other references to it on the codebase, the separate ‘datadog-lambda` uses it as of February 2021: <github.com/DataDog/datadog-lambda-rb/blob/c15f0f0916c90123416dc44e7d6800ef4a7cfdbf/lib/datadog/lambda.rb#L38>
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
-
#initialize(transport: nil, transport_options: {}, agent_settings: nil) ⇒ SyncWriter
constructor
A new instance of SyncWriter.
-
#stop ⇒ Object
Does nothing.
-
#write(trace) ⇒ Object
Sends traces to the configured transport.
Constructor Details
#initialize(transport: nil, transport_options: {}, agent_settings: nil) ⇒ SyncWriter
Returns a new instance of SyncWriter.
28 29 30 31 32 33 34 35 |
# File 'lib/datadog/tracing/sync_writer.rb', line 28 def initialize(transport: nil, transport_options: {}, agent_settings: nil) @transport = transport || begin [:agent_settings] = agent_settings if agent_settings Transport::HTTP.default(**) end @events = Writer::Events.new end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
19 20 21 |
# File 'lib/datadog/tracing/sync_writer.rb', line 19 def events @events end |
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
19 20 21 |
# File 'lib/datadog/tracing/sync_writer.rb', line 19 def transport @transport end |
Instance Method Details
#stop ⇒ Object
Does nothing. The Datadog::Tracing::SyncWriter does not need to be stopped as it holds no state.
48 49 50 51 |
# File 'lib/datadog/tracing/sync_writer.rb', line 48 def stop # No cleanup to do for the SyncWriter true end |
#write(trace) ⇒ Object
Sends traces to the configured transport.
Traces are flushed immediately.
40 41 42 43 44 |
# File 'lib/datadog/tracing/sync_writer.rb', line 40 def write(trace) flush_trace(trace) rescue => e Datadog.logger.debug(e) end |