Module: D13n::Metric::Instrumentation::WebSocketInstrumentation

Included in:
EmWebSocket
Defined in:
lib/d13n/metric/instrumentation/websocket_instrumentation.rb

Instance Method Summary collapse

Instance Method Details

#perform_websocket_with_d13n_stream(*args, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/d13n/metric/instrumentation/websocket_instrumentation.rb', line 5

def perform_websocket_with_d13n_stream(*args, &block)
  state = D13n::Metric::StreamState.st_get
  category = :websocket

  trace_options = args.last.is_a?(Hash) ? args.last : {}
  stream_options = create_stream_options(trace_options, category, state)

  begin
    stream = D13n::Metric::Stream.start(state, category, stream_options)

    begin
      yield
      update_stream_data(state)
    rescue => e
      D13n::Metric::Manager.notice_error(e)
      raise
    ensure
      D13n::Metric::Stream.stop(state)
    end
  end
end