Skip to content

Commit

Permalink
Merge pull request #136 from rebuy-de/toolstack
Browse files Browse the repository at this point in the history
improve toolstack
  • Loading branch information
svenwltr authored Jan 13, 2023
2 parents 6c87ec8 + 0b3a388 commit 54b4aa4
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions pkg/instutil/toolstack.go
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
package instutil

import (
"fmt"
"strings"

"github.com/prometheus/client_golang/prometheus"
"github.com/rebuy-de/rebuy-go-sdk/v4/pkg/cmdutil"
)

func init() {
gauge := prometheus.NewGaugeVec(prometheus.GaugeOpts{
toolstack := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "rebuy",
Name: "toolstack",
}, []string{
"toolstack",
"language",
"language_version",
"sdk",
"sdk_version",
"version",
})
prometheus.MustRegister(gauge)

major := strings.SplitN(cmdutil.SDKVersion, ".", 2)[0]
prometheus.MustRegister(toolstack)

gauge.WithLabelValues(
fmt.Sprintf("golang.rebuy-go-sdk.%s", major),
toolstack.WithLabelValues(
"golang",
cmdutil.GoVersion,
).Set(1)

toolstack.WithLabelValues(
"rebuy-go-sdk",
cmdutil.SDKVersion,
).Set(1)

buildInfo := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "rebuy",
Name: "buildinfo",
}, []string{
"builddate",
})
prometheus.MustRegister(buildInfo)

buildInfo.WithLabelValues(
cmdutil.BuildDate,
).Set(1)
}

0 comments on commit 54b4aa4

Please sign in to comment.