diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2019-09-03 14:24:27 +0000 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2019-09-03 14:24:27 +0000 |
commit | 72298390424f8364f0325452e4d5ec7b71e8f38f (patch) | |
tree | 1fd843d8b584ad1613317af07d94af31ec51c1f4 | |
parent | 4c896c81eafeee480342267c98a1884ad30c8ac3 (diff) | |
parent | 74effdcfcd9faadce07eaabfe69857492d8723b7 (diff) | |
download | gitlab-ce-72298390424f8364f0325452e4d5ec7b71e8f38f.tar.gz |
Merge branch 'docs-development_add_new_prometheus_metrics' into 'master'
Development docs: how to add Prometheus metrics
See merge request gitlab-org/gitlab-ce!32306
-rw-r--r-- | doc/development/prometheus_metrics.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/development/prometheus_metrics.md b/doc/development/prometheus_metrics.md index 576601372a3..2a34851d21c 100644 --- a/doc/development/prometheus_metrics.md +++ b/doc/development/prometheus_metrics.md @@ -44,3 +44,26 @@ class ImportCommonMetrics < ActiveRecord::Migration[4.2] end end ``` + +## GitLab Prometheus metrics + +GitLab provides [Prometheus metrics](../administration/monitoring/prometheus/gitlab_metrics.md) +to monitor itself. + +### Adding a new metric + +This section describes how to add new metrics for self-monitoring +([example](https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/15440)). + +1. Select the [type of metric](https://gitlab.com/gitlab-org/prometheus-client-mmap#metrics): + + - `Gitlab::Metrics.counter` + - `Gitlab::Metrics.gauge` + - `Gitlab::Metrics.histogram` + - `Gitlab::Metrics.summary` + +1. Select the appropriate name for your metric. Refer to the guidelines + for [Prometheus metric names](https://prometheus.io/docs/practices/naming/#metric-names). +1. Update the list of [GitLab Prometheus metrics](../administration/monitoring/prometheus/gitlab_metrics.md). +1. Trigger the relevant page/code that will record the new metric. +1. Check that the new metric appears at `/-/metrics`. |