Class: Appdash::Client
- Inherits:
-
Object
- Object
- Appdash::Client
- Defined in:
- lib/appdash/client.rb
Constant Summary collapse
- DEFAULTS =
Client defaults
{ host: 'localhost', port: 7701, max_buffer_size: 0, }.freeze
Instance Method Summary collapse
-
#close ⇒ Object
Close flushes any remaining buffered packets and closes the connection.
-
#initialize(opts = {}) ⇒ Client
constructor
Initializes a new client.
-
#span(&block) ⇒ Object
Traces a new span with a series of associated events.
Constructor Details
Instance Method Details
#close ⇒ Object
Close flushes any remaining buffered packets and closes the connection
55 56 57 58 |
# File 'lib/appdash/client.rb', line 55 def close flush_buffer! @sock.close end |
#span(&block) ⇒ Object
Traces a new span with a series of associated events. Accepts an optional block. If no block is given you must flush to send data to the collector.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/appdash/client.rb', line 43 def span(&block) span = Appdash::Span.new(self) return span unless block begin block.call(span) ensure span.flush end end |