2018-11-20 02:01:13 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-06 14:07:33 +00:00
|
|
|
module Gitlab
|
|
|
|
module Prometheus
|
|
|
|
module Queries
|
|
|
|
class AdditionalMetricsEnvironmentQuery < BaseQuery
|
|
|
|
include QueryAdditionalMetrics
|
|
|
|
|
2018-08-27 15:31:01 +00:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2019-03-15 11:20:59 +00:00
|
|
|
def query(environment_id, timeframe_start = 8.hours.ago, timeframe_end = Time.now)
|
2017-08-07 13:54:30 +00:00
|
|
|
::Environment.find_by(id: environment_id).try do |environment|
|
2017-08-01 20:11:59 +00:00
|
|
|
query_metrics(
|
2018-02-23 17:58:40 +00:00
|
|
|
environment.project,
|
2018-06-25 09:57:29 +00:00
|
|
|
environment,
|
2019-03-15 11:20:59 +00:00
|
|
|
common_query_context(
|
|
|
|
environment,
|
|
|
|
timeframe_start: timeframe_start.to_f,
|
|
|
|
timeframe_end: timeframe_end.to_f
|
|
|
|
)
|
2017-08-01 20:11:59 +00:00
|
|
|
)
|
2017-06-20 13:53:55 +00:00
|
|
|
end
|
2017-06-06 14:07:33 +00:00
|
|
|
end
|
2018-08-27 15:31:01 +00:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2017-06-06 14:07:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|