Method: GraphQL::Tracing::PrometheusTrace::GraphQLCollector#collect

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

#collect(object) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/graphql/tracing/prometheus_trace/graphql_collector.rb', line 20

def collect(object)
  default_labels = { key: object['key'], platform_key: object['platform_key'] }
  custom = object['custom_labels']
  labels = custom.nil? ? default_labels : default_labels.merge(custom)

  @graphql_gauge.observe object['duration'], labels
end