Commit 5a79a34b authored by Bas Westerbaan's avatar Bas Westerbaan

Metrics stub

parent 0a579b8a
......@@ -9,6 +9,8 @@ import (
"golang.org/x/crypto/ed25519"
"golang.org/x/crypto/sha3"
"gopkg.in/yaml.v2"
// "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"crypto/rand"
"encoding/base64"
......@@ -70,6 +72,11 @@ type Conf struct {
// How often should clients check in about public keys
PublicKeyCacheDuration time.Duration `yaml:"publicKeyCacheDuration"`
// Enable prometheus metrics.
//
// NOTE, these are publicly exposed at /metrics.
EnableMetrics bool `yaml:"enableMetrics"`
}
type AlgPkPair struct {
......@@ -386,6 +393,10 @@ func main() {
http.HandleFunc("/checkPublicKey", checkPkHandler)
http.HandleFunc("/", rootHandler)
if conf.EnableMetrics {
http.Handle("/metrics", promhttp.Handler())
}
// set up signal handler to catch keyboard interrupt
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment