Class: Datadog::SyncWriter
- Inherits:
-
Object
- Object
- Datadog::SyncWriter
- Defined in:
- lib/ddtrace/sync_writer.rb
Overview
SyncWriter flushes both services and traces synchronously DEV: To be replaced by Datadog::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>
Constant Summary collapse
- DEPRECATION_WARN_ONLY_ONCE =
Datadog::Utils::OnlyOnce.new
Instance Attribute Summary collapse
-
#priority_sampler ⇒ Object
readonly
Returns the value of attribute priority_sampler.
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SyncWriter
constructor
A new instance of SyncWriter.
-
#stop ⇒ Object
Added for interface completeness.
- #write(trace, services = nil) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ SyncWriter
Returns a new instance of SyncWriter.
21 22 23 24 25 26 27 28 29 |
# File 'lib/ddtrace/sync_writer.rb', line 21 def initialize( = {}) @transport = .fetch(:transport) do = .fetch(:transport_options, {}) [:agent_settings] = [:agent_settings] if .key?(:agent_settings) Transport::HTTP.default(**) end @priority_sampler = .fetch(:priority_sampler, nil) end |
Instance Attribute Details
#priority_sampler ⇒ Object (readonly)
Returns the value of attribute priority_sampler.
17 18 19 |
# File 'lib/ddtrace/sync_writer.rb', line 17 def priority_sampler @priority_sampler end |
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
17 18 19 |
# File 'lib/ddtrace/sync_writer.rb', line 17 def transport @transport end |
Instance Method Details
#stop ⇒ Object
Added for interface completeness
47 48 49 50 |
# File 'lib/ddtrace/sync_writer.rb', line 47 def stop # No cleanup to do for the SyncWriter true end |
#write(trace, services = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ddtrace/sync_writer.rb', line 31 def write(trace, services = nil) unless services.nil? DEPRECATION_WARN_ONLY_ONCE.run do Datadog.logger.warn(%( write: Writing services has been deprecated and no longer need to be provided. write(traces, services) can be updated to write(traces) )) end end flush_trace(trace) rescue => e Datadog.logger.debug(e) end |