json_exporter
json_exporter copied to clipboard
GoLang struct to exporter yaml configuration
Hi folks,
Is there any way to convert directly GoLang struct to exporter yaml configuration? We've a go service that expose data as JSON but we need to convert these JSONs to Prometheus format to store metrics in Prometheus/VM. Go struct is nested and complex, so I don't want to spent time on manually writing json_exporter yaml configuration for it if there is an easy way.
For example: this struct (not that simple though)
type DBInfo struct {
FullSize float64
IndexSize float64
}
to this yaml
....
metrics:
- name: full_size
path: '{.FullSize}'
- name: index_size
path: '{.IndexSize}'
Thanks in advance.