Skip to content

Commit

Permalink
export rekor build/version information
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Sep 23, 2022
1 parent 7652a61 commit 373cd45
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/rekor-server/app/root.go
Expand Up @@ -76,7 +76,7 @@ func init() {

rootCmd.PersistentFlags().String("rekor_server.signer", "memory",
`Rekor signer to use. Valid options are: [gcpkms, memory, filename containing PEM encoded private key].
Memory and file-based signers should only be used for testing.`)
Memory and file-based signers should only be used for testing.`)
rootCmd.PersistentFlags().String("rekor_server.signer-passwd", "", "Password to decrypt signer private key")

rootCmd.PersistentFlags().Uint16("port", 3000, "Port to bind to")
Expand Down
16 changes: 16 additions & 0 deletions pkg/api/metrics.go
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"sigs.k8s.io/release-utils/version"
)

var (
Expand Down Expand Up @@ -51,4 +52,19 @@ var (
Name: "rekor_qps_by_api",
Help: "Api QPS by path, method, and response code",
}, []string{"path", "method", "code"})

_ = promauto.NewGaugeFunc(
prometheus.GaugeOpts{
Namespace: "rekor",
Name: "build_info",
Help: "A metric with a constant '1' value labeled by version, revision, branch, and goversion from which rekor was built.",
ConstLabels: prometheus.Labels{
"version": version.GetVersionInfo().GitVersion,
"revision": version.GetVersionInfo().GitCommit,
"build_date": version.GetVersionInfo().BuildDate,
"goversion": version.GetVersionInfo().GoVersion,
},
},
func() float64 { return 1 },
)
)

0 comments on commit 373cd45

Please sign in to comment.