Class: Datadog::SyncWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/ddtrace/sync_writer.rb

Overview

SyncWriter flushes both services and traces synchronously

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SyncWriter

Returns a new instance of SyncWriter.



6
7
8
9
10
# File 'lib/ddtrace/sync_writer.rb', line 6

def initialize(options = {})
  @transport = options.fetch(:transport) do
    HTTPTransport.new(Writer::HOSTNAME, Writer::PORT)
  end
end

Instance Attribute Details

#transportObject (readonly)

Returns the value of attribute transport.



4
5
6
# File 'lib/ddtrace/sync_writer.rb', line 4

def transport
  @transport
end

Instance Method Details

#write(trace, services) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/ddtrace/sync_writer.rb', line 12

def write(trace, services)
  perform_concurrently(
    proc { flush_services(services) },
    proc { flush_trace(trace) }
  )
rescue => e
  Tracer.log.debug(e)
end