Skip to content

Generate sample Prometheus data

Kirstie Cook requested to merge generate-test-prometheus-data into master

What does this MR do?

The purpose of this MR is to provide a way to generate a set of example Prometheus metrics, and then also provide a way to route to those sample metrics when a particular environmental variable is set.

This MR is the first in a series that will eventually allow us to quickly load up a local Gitlab environment with sample metrics data without having to configure and install Prometheus. This will be useful for demos, testing, and speeding up development when not directly working on the Prometheus integration. The next steps will involve generating metrics over our 6 pre-set time intervals, making the data appear live, using custom metrics, and then allowing the sample metrics to be viewed on the metrics dashboard without having Prometheus configured.

This MR creates a rake task (rake gitlab:generate_sample_prometheus_data[environment_id]) that will run Prometheus queries for each of the common metrics of a specific environment for a default time interval of 7 days ago to now. The results of each of query are stored under a sample_metrics directory as a yaml 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.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports