Class: Datadog::SyncWriter
- Inherits:
-
Object
- Object
- Datadog::SyncWriter
- Defined in:
- lib/ddtrace/sync_writer.rb
Overview
SyncWriter flushes both services and traces synchronously
Instance Attribute Summary collapse
-
#runtime_metrics ⇒ Object
readonly
Returns the value of attribute runtime_metrics.
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SyncWriter
constructor
A new instance of SyncWriter.
- #write(trace, services = nil) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ SyncWriter
Returns a new instance of SyncWriter.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ddtrace/sync_writer.rb', line 12 def initialize( = {}) @transport = .fetch(:transport) do = .fetch(:transport_options, {}) Transport::HTTP.default() end # Runtime metrics @runtime_metrics = .fetch(:runtime_metrics) do Runtime::Metrics.new end end |
Instance Attribute Details
#runtime_metrics ⇒ Object (readonly)
Returns the value of attribute runtime_metrics.
8 9 10 |
# File 'lib/ddtrace/sync_writer.rb', line 8 def runtime_metrics @runtime_metrics end |
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
8 9 10 |
# File 'lib/ddtrace/sync_writer.rb', line 8 def transport @transport end |
Instance Method Details
#write(trace, services = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ddtrace/sync_writer.rb', line 24 def write(trace, services = nil) unless services.nil? Datadog::Patcher.do_once('SyncWriter#write') do Datadog::Tracer.log.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 Tracer.log.debug(e) end |