Class: GraphQL::Tracing::PrometheusTracing::GraphQLCollector
- Inherits:
 - 
      PrometheusExporter::Server::TypeCollector
      
        
- Object
 - PrometheusExporter::Server::TypeCollector
 - GraphQL::Tracing::PrometheusTracing::GraphQLCollector
 
 
- Defined in:
 - lib/graphql/tracing/prometheus_tracing/graphql_collector.rb
 
Instance Method Summary collapse
- 
  
    
      #collect(object)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      #initialize  ⇒ GraphQLCollector 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of GraphQLCollector.
 - 
  
    
      #metrics  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
 - 
  
    
      #type  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
 
Constructor Details
#initialize ⇒ GraphQLCollector
Returns a new instance of GraphQLCollector.
      7 8 9 10 11 12  | 
    
      # File 'lib/graphql/tracing/prometheus_tracing/graphql_collector.rb', line 7 def initialize @graphql_gauge = PrometheusExporter::Metric::Summary.new( 'graphql_duration_seconds', 'Time spent in GraphQL operations, in seconds' ) end  | 
  
Instance Method Details
#collect(object) ⇒ Object
      18 19 20 21  | 
    
      # File 'lib/graphql/tracing/prometheus_tracing/graphql_collector.rb', line 18 def collect(object) labels = { key: object['key'], platform_key: object['platform_key'] } @graphql_gauge.observe object['duration'], labels end  | 
  
#metrics ⇒ Object
      23 24 25  | 
    
      # File 'lib/graphql/tracing/prometheus_tracing/graphql_collector.rb', line 23 def metrics [@graphql_gauge] end  | 
  
#type ⇒ Object
      14 15 16  | 
    
      # File 'lib/graphql/tracing/prometheus_tracing/graphql_collector.rb', line 14 def type 'graphql' end  |