summaryrefslogtreecommitdiff
path: root/doc/development/prometheus_metrics.md
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-08-28 10:56:11 +1200
committerThong Kuah <tkuah@gitlab.com>2019-09-02 14:28:44 +1200
commit24a9d3b1b88de2ff298bdbe8cad16b2b8e6ab04b (patch)
tree6b332c098db61161d4ba9c905061884da1589992 /doc/development/prometheus_metrics.md
parentbb99271147382d7f2b3f2d5069840e7ab6e554a0 (diff)
downloadgitlab-ce-24a9d3b1b88de2ff298bdbe8cad16b2b8e6ab04b.tar.gz
Development docs: how to add Prometheus metrics
This documents the various knowledge needed to add new GitLab self-monitoring Prometheus metrics.
Diffstat (limited to 'doc/development/prometheus_metrics.md')
-rw-r--r--doc/development/prometheus_metrics.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/development/prometheus_metrics.md b/doc/development/prometheus_metrics.md
index 576601372a3..a6549f72040 100644
--- a/doc/development/prometheus_metrics.md
+++ b/doc/development/prometheus_metrics.md
@@ -44,3 +44,24 @@ 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`.