This repository was archived by the owner on Feb 13, 2025. It is now read-only.
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
custom metrics via select. #2
Closed
Description
Hi,
I would like to add a custom query (sql select read from config) that generates a gauge per row. I have some backend devs here who could like to formulate a query/view best.
will be my first go code :-) , i nearly got lost compiling the thing on windows (the oracle driver parts).
my idea would be like:
content, err := ioutil.ReadFile(*configFile)
err = yaml.Unmarshal(content, &config)
// ScrapeCustomSQL collects a custom query wiith name/value columns in its rows.
func ScrapeCustomSQL(db *sql.DB, ch chan<- prometheus.Metric, config.sqlQuery string) error
..
rows.Scan(&name, &value)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(prometheus.BuildFQName(namespace, "custom", name),
"Generic counter metric from sql in Oracle.", []string{}, nil),
prometheus.GaugeValue,
value,
Metadata
Metadata
Assignees
Labels
No labels