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: 1, }.freeze
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Client
constructor
Initializes a new client.
-
#shutdown ⇒ Object
Shutdown flushes any remaining buffered packets and closes the connection.
-
#span(&block) ⇒ Object
Traces a new span with a series of associated events.
Constructor Details
Instance Method Details
#shutdown ⇒ Object
Shutdown flushes any remaining buffered packets and closes the connection
54 55 56 57 |
# File 'lib/appdash/client.rb', line 54 def shutdown flush_buffer! @sock.shutdown 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.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/appdash/client.rb', line 42 def span(&block) span = Appdash::Span.new(self) return span unless block begin block.call(span) ensure span.flush end end |