summaryrefslogtreecommitdiff
path: root/lib/gitlab/prometheus/queries/additional_metrics_deployment_query.rb
blob: 382052c298f11064d075d65e98f1e939ba448e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Gitlab::Prometheus::Queries
  class AdditionalMetricsDeploymentQuery < AdditionalMetricsQuery

    def query(deployment_id)
      deployment = Deployment.find_by(id: deployment_id)
      query_context = {
        environment_slug: deployment.environment.slug,
        environment_filter: %{container_name!="POD",environment="#{deployment.environment.slug}"},
        timeframe_start: (deployment.created_at - 30.minutes).to_f,
        timeframe_end: (deployment.created_at + 30.minutes).to_f
      }

      query_metrics(query_context)
    end
  end
end