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.
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.
13 14 15 16 17 18 19 20 |
# File 'lib/ddtrace/sync_writer.rb', line 13 def initialize( = {}) @transport = .fetch(:transport) do = .fetch(:transport_options, {}) 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.
9 10 11 |
# File 'lib/ddtrace/sync_writer.rb', line 9 def priority_sampler @priority_sampler end |
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
9 10 11 |
# File 'lib/ddtrace/sync_writer.rb', line 9 def transport @transport end |
Instance Method Details
#stop ⇒ Object
Added for interface completeness
40 41 42 43 |
# File 'lib/ddtrace/sync_writer.rb', line 40 def stop # No cleanup to do for the SyncWriter true end |
#write(trace, services = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ddtrace/sync_writer.rb', line 22 def write(trace, services = nil) unless services.nil? Datadog::Patcher.do_once('SyncWriter#write') do Datadog.logger.warn(%( write: Writing services has been deprecated and no longer need to be provided. write(traces, services) can be updted to write(traces) )) end end perform_concurrently( proc { flush_trace(trace) } ) rescue => e Datadog.logger.debug(e) end |