additional_metrics_deployment_query.rb 603 Bytes
Newer Older
1 2 3 4 5
module Gitlab
  module Prometheus
    module Queries
      class AdditionalMetricsDeploymentQuery < BaseQuery
        include QueryAdditionalMetrics
6

Pawel Chojnacki's avatar
wip  
Pawel Chojnacki committed
7
        def query(environment_id, deployment_id)
8
          Deployment.find_by(id: deployment_id).try do |deployment|
9 10 11
            query_metrics(
              common_query_context(
                deployment.environment,
12 13
                timeframe_start: (deployment.created_at - 30.minutes).to_f,
                timeframe_end: (deployment.created_at + 30.minutes).to_f
14
              )
15
            )
16
          end
17 18
        end
      end
19 20 21
    end
  end
end