metricsmd

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2025 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(reg *prometheus.Registry, w io.Writer, config *Config) error

Generate

func NewCmd

func NewCmd(vp *viper.Viper, log *slog.Logger, config *Config) (*cobra.Command, error)

NewCmd creates a Cobra command for generating metrics reference docs. It's intended to be used as an add-on to applications that have a Cobra CLI and expose Prometheus metrics.

Types

type Config

type Config struct {
	CobraAnnotations     map[string]string
	Targets              map[string]string // cli argument -> docs header
	LabelOverrides       []LabelOverrides
	InitMetrics          func(target string, reg *prometheus.Registry, log *slog.Logger) error
	AutogeneratedComment bool
	HeadingLevel         int // must be between 0 and 4
}

type LabelOverrides

type LabelOverrides struct {
	Metric    string
	Overrides []LabelValues
}

type LabelValues

type LabelValues struct {
	Label  string
	Values []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL