Skip to content

doc: add automated metrics documentation generator#3585

Open
Pittu-Sharma wants to merge 1 commit intoprometheus:masterfrom
Pittu-Sharma:issue-2302-metrics-doc
Open

doc: add automated metrics documentation generator#3585
Pittu-Sharma wants to merge 1 commit intoprometheus:masterfrom
Pittu-Sharma:issue-2302-metrics-doc

Conversation

@Pittu-Sharma
Copy link

Summary

This PR introduces an automated approach to generate metrics documentation directly from the node_exporter collector source code.

Problem

Currently, maintaining docs/METRICS.md is a manual process, which can become outdated as new metrics are added or modified. This creates inconsistency between the actual exported metrics and the documentation.

Solution

This PR adds a tool that parses the collector source files using Go AST (go/ast) to extract:

  • Metric names
  • Help descriptions
  • Metric types

The extracted information is used to automatically generate the metrics documentation.

Changes Made

  • Added a script to generate metrics documentation from collector code
  • Updated docs/METRICS.md with generated content
  • Added a Makefile target to automate documentation updates

Benefits

  • Ensures documentation is always consistent with the code
  • Reduces manual maintenance effort
  • Improves reliability of metrics documentation

Related Issue

Fixes #2302

Notes

This approach avoids requiring a running exporter instance and instead relies on static analysis of the source code.

This adds a tool to statically analyze collectors and generate a
comprehensive metrics list in docs/METRICS.md. This ensures the
documentation remains accurate and maintainable.

Signed-off-by: pittu sharma <pittusharma47@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Complete Documentation of the Metrics

1 participant