Module: GraphQL::Tracing::PrometheusTrace

Includes:
PlatformTrace
Defined in:
lib/graphql/tracing/prometheus_trace.rb,
lib/graphql/tracing/prometheus_trace/graphql_collector.rb

Defined Under Namespace

Classes: GraphQLCollector

Instance Method Summary collapse

Instance Method Details

#initialize(client: PrometheusExporter::Client.default, keys_whitelist: ["execute_field", "execute_field_lazy"], collector_type: "graphql", **rest) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/graphql/tracing/prometheus_trace.rb', line 13

def initialize(client: PrometheusExporter::Client.default, keys_whitelist: ["execute_field", "execute_field_lazy"], collector_type: "graphql", **rest)
  @client = client
  @keys_whitelist = keys_whitelist
  @collector_type = collector_type

  super(**rest)
end

#platform_authorized(platform_key, &block) ⇒ Object



46
47
48
# File 'lib/graphql/tracing/prometheus_trace.rb', line 46

def platform_authorized(platform_key, &block)
  instrument_prometheus_execution(platform_key, "authorized", &block)
end

#platform_authorized_key(type) ⇒ Object



66
67
68
# File 'lib/graphql/tracing/prometheus_trace.rb', line 66

def platform_authorized_key(type)
  "#{type.graphql_name}.authorized"
end

#platform_authorized_lazy(platform_key, &block) ⇒ Object



50
51
52
# File 'lib/graphql/tracing/prometheus_trace.rb', line 50

def platform_authorized_lazy(platform_key, &block)
  instrument_prometheus_execution(platform_key, "authorized_lazy", &block)
end

#platform_execute_field(platform_key, &block) ⇒ Object



38
39
40
# File 'lib/graphql/tracing/prometheus_trace.rb', line 38

def platform_execute_field(platform_key, &block)
  instrument_prometheus_execution(platform_key, "execute_field", &block)
end

#platform_execute_field_lazy(platform_key, &block) ⇒ Object



42
43
44
# File 'lib/graphql/tracing/prometheus_trace.rb', line 42

def platform_execute_field_lazy(platform_key, &block)
  instrument_prometheus_execution(platform_key, "execute_field_lazy", &block)
end

#platform_field_key(field) ⇒ Object



62
63
64
# File 'lib/graphql/tracing/prometheus_trace.rb', line 62

def platform_field_key(field)
  field.path
end

#platform_resolve_type(platform_key, &block) ⇒ Object



54
55
56
# File 'lib/graphql/tracing/prometheus_trace.rb', line 54

def platform_resolve_type(platform_key, &block)
  instrument_prometheus_execution(platform_key, "resolve_type", &block)
end

#platform_resolve_type_key(type) ⇒ Object



70
71
72
# File 'lib/graphql/tracing/prometheus_trace.rb', line 70

def platform_resolve_type_key(type)
  "#{type.graphql_name}.resolve_type"
end

#platform_resolve_type_lazy(platform_key, &block) ⇒ Object



58
59
60
# File 'lib/graphql/tracing/prometheus_trace.rb', line 58

def platform_resolve_type_lazy(platform_key, &block)
  instrument_prometheus_execution(platform_key, "resolve_type_lazy", &block)
end