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:
https://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.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/datadog/tracing/sync_writer.rb', line 30 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.
19 20 21 |
# File 'lib/datadog/tracing/sync_writer.rb', line 19 def agent_settings @agent_settings end |
#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 |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
19 20 21 |
# File 'lib/datadog/tracing/sync_writer.rb', line 19 def logger @logger 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.
52 53 54 55 |
# File 'lib/datadog/tracing/sync_writer.rb', line 52 def stop # No cleanup to do for the SyncWriter true end |
#write(trace) ⇒ Object
Sends traces to the configured transport.
Traces are flushed immediately.
44 45 46 47 48 |
# File 'lib/datadog/tracing/sync_writer.rb', line 44 def write(trace) flush_trace(trace) rescue => e logger.debug(e) end |