-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add metricsmd package #3
Conversation
Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
8ee44dd
to
5e19bd7
Compare
The metricsmd.Generate function reads a Prometheus registry and generates a Markdown reference documentation listing metrics, their help texts and labels. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
It's intended to be used as an add-on to applications that have a Cobra CLI and expose Prometheus metrics. The returned command generates a metrics reference documentation. Co-authored-by: Chance Zibolski <chance.zibolski@gmail.com> Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
5e19bd7
to
2858155
Compare
Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
Move all configuration options into one Config struct, passed to NewCmd and Generate functions. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
4a9deeb
to
8a3cd99
Compare
Having such a comment in the final docs HTML might be undesirable, and this is the case e.g. when the markdown is rendered with Hugo. Additionally, if metrics from multiple targets are compiled into one reference file, then it would include redundant comments. The "autogenerated" comment can still be enabled with a config option. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
This is useful when the metrics reference is embedded in another markdown document. Requested here: cilium/tetragon#2164 (comment) cilium/tetragon#2164 (comment) Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
Validating passed Config prevents a panic or rendering invalid markdown. Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
8a3cd99
to
23fc556
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I mostly checked the last commits with the options and it's a good addition :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think GitHub automatically does this appropriately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, does it? That's cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah go.sum
is always displayed but vendored stuff is redacted except for appropriate stuff like vendor/modules.txt
. See your PR for example https://github.com/cilium/tetragon/pull/2164/files.
pkg/metricsmd
is a utility for generating a metrics reference in the markdown format from initialized Prometheus registry. It's intended to be used as an add-on to applications that have a Cobra CLI and expose Prometheus metrics.For example usage see cilium/tetragon#2164