debian-mirror-gitlab/lib/gitlab/prometheus/queries/additional_metrics_environment_query.rb

28 lines
788 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
module Gitlab
module Prometheus
module Queries
class AdditionalMetricsEnvironmentQuery < BaseQuery
include QueryAdditionalMetrics
2018-12-05 23:21:45 +05:30
# rubocop: disable CodeReuse/ActiveRecord
2019-07-07 11:18:12 +05:30
def query(environment_id, timeframe_start = 8.hours.ago, timeframe_end = Time.now)
2017-09-10 17:25:29 +05:30
::Environment.find_by(id: environment_id).try do |environment|
query_metrics(
2018-03-27 19:54:05 +05:30
environment.project,
2018-11-18 11:00:15 +05:30
environment,
2019-07-07 11:18:12 +05:30
common_query_context(
environment,
timeframe_start: timeframe_start.to_f,
timeframe_end: timeframe_end.to_f
)
2017-09-10 17:25:29 +05:30
)
end
end
2018-12-05 23:21:45 +05:30
# rubocop: enable CodeReuse/ActiveRecord
2017-09-10 17:25:29 +05:30
end
end
end
end