summaryrefslogtreecommitdiff
path: root/app/models/environment.rb
diff options
context:
space:
mode:
authorsyasonik <syasonik@gitlab.com>2019-03-15 19:20:59 +0800
committersyasonik <syasonik@gitlab.com>2019-04-03 17:21:56 +0800
commitab1e1b55a84ffc6b09233a6831be9bdc77c05115 (patch)
treedd59f2fd052b1112429580855536faa59855972a /app/models/environment.rb
parent478077747da82a3dfaafbebc1797b26b965b030f (diff)
downloadgitlab-ce-ab1e1b55a84ffc6b09233a6831be9bdc77c05115.tar.gz
Specify time window for additional metrics apisupport-time-windows-api
Adds support for start and end parameters in the #additional_metrics endpoint of the EnvironmentsController. start and end are meant to be unix timestamps, per the Prometheus API (as the consumer of this endpoint will eventually be transitioned to a prometheus endpoint). This functionality is behind the :metrics_time_window feature flag for development.
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 25373c7a1f7..fa29a83e517 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -170,8 +170,10 @@ class Environment < ApplicationRecord
prometheus_adapter.query(:environment, self) if has_metrics?
end
- def additional_metrics
- prometheus_adapter.query(:additional_metrics_environment, self) if has_metrics?
+ def additional_metrics(*args)
+ return unless has_metrics?
+
+ prometheus_adapter.query(:additional_metrics_environment, self, *args.map(&:to_f))
end
# rubocop: disable CodeReuse/ServiceClass