Prometheus integration (FREE)

Introduced in GitLab 9.0.

GitLab offers powerful integration with Prometheus for monitoring key metrics of your apps, directly in GitLab. Metrics for each environment are retrieved from Prometheus, and then displayed in the GitLab interface.

Environment Dashboard

There are two ways to set up Prometheus integration, depending on where your apps are running:

Once enabled, GitLab detects metrics from known services in the metric library. You can also add your own metrics and create custom dashboards.

Enabling Prometheus Integration

Prometheus cluster integration

  • Introduced in GitLab 13.11.
  • Replaced the Prometheus cluster applications in GitLab 14.0.

GitLab can query an in-cluster Prometheus for your metrics. See Prometheus cluster integration for details.

Manual configuration of Prometheus

Requirements

Integration with Prometheus requires the following:

  1. GitLab 9.0 or higher
  2. Prometheus must be configured to collect one of the supported metrics
  3. Each metric must be have a label to indicate the environment
  4. GitLab must have network connectivity to the Prometheus server

Getting started

Installing and configuring Prometheus to monitor applications is fairly straightforward.

  1. Install Prometheus
  2. Set up one of the supported monitoring targets
  3. Configure the Prometheus server to collect their metrics

Configuration in GitLab

The actual configuration of Prometheus integration in GitLab requires the domain name or IP address of the Prometheus server you'd like to integrate with. If the Prometheus resource is secured with Google's Identity-Aware Proxy (IAP), you can pass information like Client ID and Service Account credentials. GitLab can use these to access the resource. More information about authentication from a service account can be found at Google's documentation for Authenticating from a service account.

  1. Navigate to the Integrations page at Settings > Integrations.
  2. Click the Prometheus service.
  3. For API URL, provide the domain name or IP address of your server, such as http://prometheus.example.com/ or http://192.0.2.1/.
  4. (Optional) In Google IAP Audience Client ID, provide the Client ID of the Prometheus OAuth Client secured with Google IAP.
  5. (Optional) In Google IAP Service Account JSON, provide the contents of the Service Account credentials file that is authorized to access the Prometheus resource. The JSON key token_credential_uri is discarded to prevent Server-side Request Forgery (SSRF).
  6. Click Save changes.

Configure Prometheus Service

Thanos configuration in GitLab

You can configure Thanos as a drop-in replacement for Prometheus with GitLab. Use the domain name or IP address of the Thanos server you'd like to integrate with.

  1. Navigate to the Integrations page.
  2. Click the Prometheus service.
  3. Provide the domain name or IP address of your server, for example http://thanos.example.com/ or http://192.0.2.1/.
  4. Click Save changes.

Precedence with multiple Prometheus configurations

Although you can enable both a manual configuration and cluster integration of Prometheus, you can use only one:

Determining the performance impact of a merge

Developers can view the performance impact of their changes in the merge request workflow. This feature requires Kubernetes metrics.

When a source branch has been deployed to an environment, a sparkline and numeric comparison of the average memory consumption displays. On the sparkline, a dot indicates when the current changes were deployed, with up to 30 minutes of performance data displayed before and after. The comparison shows the difference between the 30 minute average before and after the deployment. This information is updated after each commit has been deployed.

Once merged and the target branch has been redeployed, the metrics switches to show the new environments this revision has been deployed to.

Performance data is available for the duration it is persisted on the Prometheus server.

Merge Request with Performance Impact