diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-19 21:07:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-19 21:07:48 +0300 |
commit | b5571e6e22cdacc81f78eff5943d68c8ba220fbb (patch) | |
tree | 3677b792f5afe0b4853cee59e166df961993b7e8 /lib/tasks | |
parent | f92a53a216e6e7d5037ac701efbee5628f91aa9a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gitlab/generate_sample_prometheus_data.rake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/tasks/gitlab/generate_sample_prometheus_data.rake b/lib/tasks/gitlab/generate_sample_prometheus_data.rake index a988494ca61..250eaaa5568 100644 --- a/lib/tasks/gitlab/generate_sample_prometheus_data.rake +++ b/lib/tasks/gitlab/generate_sample_prometheus_data.rake @@ -8,12 +8,17 @@ namespace :gitlab do sample_metrics_directory_name = Metrics::SampleMetricsService::DIRECTORY FileUtils.mkdir_p(sample_metrics_directory_name) + sample_metrics_intervals = [30.minutes, 180.minutes, 8.hours, 24.hours, 72.hours, 7.days] + metrics.each do |metric| query = metric.query % query_variables - result = environment.prometheus_adapter.prometheus_client.query_range(query, start: 7.days.ago) next unless metric.identifier + result = sample_metrics_intervals.each_with_object({}) do |interval, memo| + memo[interval.to_i / 60] = environment.prometheus_adapter.prometheus_client.query_range(query, start: interval.ago) + end + File.write("#{sample_metrics_directory_name}/#{metric.identifier}.yml", result.to_yaml) end end |