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
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
-
#agent_settings ⇒ Object
readonly
Returns the value of attribute agent_settings.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
-
#initialize(transport: nil, transport_options: {}, agent_settings: nil, logger: Datadog.logger) ⇒ 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, logger: Datadog.logger) ⇒ SyncWriter
Returns a new instance of SyncWriter.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/datadog/tracing/sync_writer.rb', line 29 def initialize(transport: nil, transport_options: {}, agent_settings: nil, logger: Datadog.logger) @logger = logger @agent_settings = agent_settings @transport = transport || begin Transport::HTTP.default(agent_settings: agent_settings, logger: logger, **) end @events = Writer::Events.new end |
Instance Attribute Details
#agent_settings ⇒ Object (readonly)
Returns the value of attribute agent_settings.
18 19 20 |
# File 'lib/datadog/tracing/sync_writer.rb', line 18 def agent_settings @agent_settings end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
18 19 20 |
# File 'lib/datadog/tracing/sync_writer.rb', line 18 def events @events end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
18 19 20 |
# File 'lib/datadog/tracing/sync_writer.rb', line 18 def logger @logger end |
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
18 19 20 |
# File 'lib/datadog/tracing/sync_writer.rb', line 18 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.
51 52 53 54 |
# File 'lib/datadog/tracing/sync_writer.rb', line 51 def stop # No cleanup to do for the SyncWriter true end |
#write(trace) ⇒ Object
Sends traces to the configured transport.
Traces are flushed immediately.
43 44 45 46 47 |
# File 'lib/datadog/tracing/sync_writer.rb', line 43 def write(trace) flush_trace(trace) rescue => e logger.debug(e) end |