Skip to content

Commit

Permalink
chore(doc): Document how to add a new metric
Browse files Browse the repository at this point in the history
  • Loading branch information
vmercierfr committed Nov 27, 2023
1 parent d967bd2 commit 0e74855
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/add-metric.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Add a metric

This document explains how to add a new metric in the exporter:

Requirements:

- Metric must be relevant to create alert or visualization (🚩 Don't collect metrics just for convenient visualization)
- Metric names and labels must follow the [Prometheus best practices](https://prometheus.io/docs/practices/naming/)

Steps:

1. Define metric names and labels

1. Implement it

1. Add a new field in `rdsCollector` structure in `internal/app/exporter/exporter.go`
1. Add metrics description in `NewCollector()` function in `internal/app/exporter/exporter.go`
1. Collect the metrics
1. Export the result in `Collect()` in `internal/app/exporter/exporter.go`

1. Add tests

1. Test metrics in an AWS environment

1. Add metric in the `README.md`

1. Commit with `feat(metric): Add <metric> <short description>` message to mark it a new feature in the release's changelog.

1. Optional. Update Grafana dashboards to display the metric

1. Optional. Add alert using the new metric in [DMF](https://github.com/qonto/database-monitoring-framework)

0 comments on commit 0e74855

Please sign in to comment.