Class: Gitlab::Prometheus::Queries::KnativeInvocationQuery

Inherits:
BaseQuery
  • Object
show all
Includes:
QueryAdditionalMetrics
Defined in:
lib/gitlab/prometheus/queries/knative_invocation_query.rb

Instance Attribute Summary

Attributes inherited from BaseQuery

#client

Instance Method Summary collapse

Methods included from QueryAdditionalMetrics

#query_metrics

Methods inherited from BaseQuery

#initialize, #raw_cpu_usage_query, #raw_memory_usage_query

Constructor Details

This class inherits a constructor from Gitlab::Prometheus::Queries::BaseQuery

Instance Method Details

#query(serverless_function_id) ⇒ Object


9
10
11
12
13
14
15
16
17
18
# File 'lib/gitlab/prometheus/queries/knative_invocation_query.rb', line 9

def query(serverless_function_id)
  PrometheusMetricsFinder
    .new(identifier: :system_metrics_knative_function_invocation_count, common: true)
    .execute
    .first
    .to_query_metric
    .tap do |q|
      q.queries[0][:result] = run_query(q.queries[0][:query_range], context(serverless_function_id))
    end
end