influxdata / influxdata/influxdb

Make Prometheus metrics compliant with Prometheus conventions

Open
#12,047 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Running `promtool check metrics` against InfluxDB v2.0.0-alpha.2 gives me:

```
curl -s http://localhost:9999/metrics | ./promtool check metrics
storage_cache_written_bytes counter metrics should have "_total" suffix
storage_series_file_segments_total non-counter metrics should not have "_total" suffix
storage_series_file_series_created counter metrics should have "_total" suffix
storage_tsi_index_series_created counter metrics should have "_total" suffix
storage_series_file_series_total non-counter metrics should not have "_total" suffix
storage_tsi_index_series_dropped counter metrics should have "_total" suffix
storage_tsi_index_files_total non-counter metrics should not have "_total" suffix
storage_tsi_index_series_total non-counter metrics should not have "_total" suffix
storage_tsm_files_total non-counter metrics should not have "_total" suffix
storage_wal_segments_total non-counter metrics should not have "_total" suffix
```

There are also other things that don't follow the conventions at https://prometheus.io/docs/practices/naming/, for example, using non-base units.

Further, some metrics are tracking access to individual files over HTTP, like:

```
http_api_requests_total{handler="platform",method="GET",path="/Roboto-Regular.f82a1950.ttf",status="2XX"} 1
```

That could get quite high-cardinality if there are many files, it would probably make sense to just group those into patterns and track that instead.

I also see a bunch of metrics that are marked as type `counter`, but actually look like they should be gauges. E.g.:

```
# HELP influxdb_organizations_total Number of total organizations on the server
# TYPE influxdb_organizations_total counter
influxdb_organizations_total 1
# HELP influxdb_scrapers_total Number of total scrapers on the server
# TYPE influxdb_scrapers_total counter
influxdb_scrapers_total 2
# HELP influxdb_telegrafs_total Number of total telegraf configurations on the server
# TYPE influxdb_telegrafs_total counter
influxdb_telegrafs_total 0
# HELP influxdb_tokens_total Number of total tokens on the server
# TYPE influxdb_tokens_total counter
influxdb_tokens_total 1
```

Contributor guide

Open the contributing guide

Research direction

Start by running the reported curl and promtool check metrics command against the metrics endpoint, then inventory the naming, unit, type, and label issues described in the report. Done means the exposed metrics follow Prometheus naming conventions, use appropriate counter or gauge types, and avoid unbounded file-path cardinality.

Written by the indexing model from the issue text.

Assessment

Tech stack
prometheus
Domain
observability
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.