2020-10-30 17:08:52 -04:00
---
2020-11-02 22:08:56 -05:00
stage: Monitor
2021-03-18 11:09:04 -04:00
group: Monitor
2020-11-26 01:09:20 -05:00
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-10-30 17:08:52 -04:00
---
2021-01-28 01:08:59 -05:00
# Generate sample Prometheus data **(FREE SELF)**
2019-12-16 16:08:00 -05:00
2020-11-18 10:09:08 -05:00
This command runs Prometheus queries for each of the metrics of a specific environment
2020-04-21 11:21:10 -04:00
for a series of time intervals to now:
- 30 minutes
- 3 hours
- 8 hours
- 24 hours
- 72 hours
- 7 days
The results of each of query are stored under a `sample_metrics` directory as a YAML
2019-12-19 13:07:48 -05:00
file named by the metric's `identifier` . When the environmental variable `USE_SAMPLE_METRICS`
is set, the Prometheus API query is re-routed to `Projects::Environments::SampleMetricsController`
which loads the appropriate data set if it is present within the `sample_metrics` directory.
2019-12-16 16:08:00 -05:00
2020-04-21 11:21:10 -04:00
This command requires an ID from an environment with an available Prometheus installation.
## Example
2019-12-16 16:08:00 -05:00
2020-04-21 11:21:10 -04:00
The following example demonstrates how to run the Rake task:
2019-12-16 16:08:00 -05:00
2020-03-02 22:08:31 -05:00
```shell
2019-12-16 16:08:00 -05:00
bundle exec rake gitlab:generate_sample_prometheus_data[21]
```