Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "net/http"
- "github.com/deathowl/go-metrics-prometheus"
- "github.com/rcrowley/go-metrics"
- // "syslog"
- "flag"
- "time"
- "github.com/prometheus/client_golang/prometheus"
- )
- var (
- addr = flag.String("localhost", ":8181", "The address to listen on for HTTP requests.")
- )
- func main() {
- metricsRegistry := metrics.NewRegistry()
- prometheusRegistry := prometheus.NewRegistry()
- c := metrics.NewCounter()
- metricsRegistry.Register("foo", c)
- c.Inc(1)
- pClient := prometheusmetrics.NewPrometheusProvider(metricsRegistry, "cpu.temperature.celsius", "subsysString", prometheusRegistry, 1*time.Second)
- pClient.UpdatePrometheusMetrics()
- http.Handle("/metrics", prometheus.Handler())
- http.ListenAndServe(*addr, nil)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement