Method: GraphQL::Tracing::PrometheusTrace::PrometheusMonitor#instrument

Defined in:
lib/graphql/tracing/prometheus_trace.rb

#instrument(keyword, object) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/graphql/tracing/prometheus_trace.rb', line 46

def instrument(keyword, object)
  if active?(keyword)
    start = gettime
    result = yield
    duration = gettime - start
    send_json(duration, keyword, object)
    result
  else
    yield
  end
end