prometheus / prometheus/node_exporter

finer grain control of systemd metrics

Open
#1,790 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
13.8k
Forks
2.7k
Avg merge
1d 23h
Merged PRs (30d)
8

Description

As raised at https://github.com/prometheus/node_exporter/issues/1201#issuecomment-540264723, it isn't possible to get --collector.systemd.enable-restarts-metrics without pulling in other, very numerous metrics that come with --collector.systemd.

For example, on our prometheus deployment, metric node_systemd_unit_state represents 14% of our total metric key space. It's wasteful, as we only need node_systemd_service_restart_total (which is 2% of key space).

non-solution: "filter at the server side". We want to prevent these sizable, unneeded metrics from affecting the leaves and intermediaries of the system.

questionable-solution: "use systemd exporter". Why must we learn, configure, and deploy another exporter when node_exporter already has the metric we need?

Proposal: add a new flag to disable the default metrics of --collector.systemd (method collectUnitStatusMetrics of the collector)

https://github.com/prometheus/node_exporter/blob/8c3de12c2213c775217290d2b97f465c23f7bff6/collector/systemd_linux.go#L179

cc: @pgier

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in collector/systemd_linux.go at collectUnitStatusMetrics and trace how --collector.systemd.enable-restarts-metrics is registered and used. Add the proposed control for the default systemd metrics, then verify that restart metrics remain available without the unwanted unit-state metrics. Done means the collector can emit only the requested restart metrics.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.