2021-01-29 00:20:46 +05:30
---
stage: Monitor
2022-04-04 11:22:00 +05:30
group: Respond
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2021-01-29 00:20:46 +05:30
---
2023-05-27 22:25:52 +05:30
# Sample Prometheus data Rake task **(FREE SELF)**
2020-01-01 13:55:28 +05:30
2023-05-27 22:25:52 +05:30
The Rake task runs Prometheus queries for each of the metrics of a specific environment
2020-05-24 23:13:21 +05:30
for a series of time intervals to now:
- 30 minutes
- 3 hours
- 8 hours
- 24 hours
- 72 hours
- 7 days
2023-05-27 22:25:52 +05:30
The results of each query are stored under a `sample_metrics` directory as a YAML
2020-03-13 15:44:24 +05:30
file named by the metric's `identifier` . When the environmental variable `USE_SAMPLE_METRICS`
2023-05-27 22:25:52 +05:30
is set, the Prometheus API query is re-routed to `Projects::Environments::SampleMetricsController` ,
which loads the appropriate data set if it's present in the `sample_metrics` directory.
2020-01-01 13:55:28 +05:30
2023-05-27 22:25:52 +05:30
The Rake task requires an ID from an environment with an available Prometheus installation.
2020-05-24 23:13:21 +05:30
## Example
2020-01-01 13:55:28 +05:30
2020-05-24 23:13:21 +05:30
The following example demonstrates how to run the Rake task:
2020-01-01 13:55:28 +05:30
2020-04-08 14:13:33 +05:30
```shell
2020-01-01 13:55:28 +05:30
bundle exec rake gitlab:generate_sample_prometheus_data[21]
```