For Registerer interface expose all registered Metrics
Providing users with a clear understanding of available metrics is currently a significant challenge. The only way to discover them is by running a service and scraping, which is not ideal for usability. As open-source maintainers, we often get asked about our exposed metrics.
Although we have an automated documentation system that updates upon metric addition (e.g., https://kubernetes-sigs.github.io/external-dns/latest/docs/monitoring/metrics/#supported-metrics, leveraging our wrapper at https://github.com/kubernetes-sigs/external-dns/blob/09ec020d6f3fe0a5fae0a1b693fb31e2f3e377a2/pkg/metrics/metrics.go#L55), and our providers (like AWS, GCP, Cloudflare - see AWS example: https://github.com/aws/aws-sdk-go-v2/discussions/2810) do expose metrics, we're struggling to automatically include this in our documentation.
Attempts using reflection have proven overly complex.
Example for the same challange
- https://github.com/thanos-io/thanos/issues/5758
- https://github.com/prometheus/prometheus/issues/12397
There was an effort to implement https://github.com/prometheus/client_golang/pull/890
I do not think, it should generate any markdown, instead return a collection of all registered metrics.
Benefits
- automated documentation
- some help to unit tests as well aka metrics registered or not