Skip to content

Commit

Permalink
Remove deprecated version function (#591)
Browse files Browse the repository at this point in the history
Remove deprecated version.NewCollector function. This has been moved to
`github.com/prometheus/client_golang`. This fixes the circular
dependency between the two repos.

Signed-off-by: SuperQ <superq@gmail.com>
  • Loading branch information
SuperQ authored Mar 7, 2024
1 parent 1e6ac24 commit 6aadcf4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/google/go-cmp v0.6.0
github.com/julienschmidt/httprouter v1.3.0
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
github.com/prometheus/client_golang v1.19.0
github.com/prometheus/client_model v0.6.0
golang.org/x/net v0.21.0
golang.org/x/oauth2 v0.17.0
Expand All @@ -23,6 +22,7 @@ require (
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
Expand Down
29 changes: 0 additions & 29 deletions version/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"runtime"
"strings"
"text/template"

"github.com/prometheus/client_golang/prometheus"
)

// Build information. Populated at build-time.
Expand All @@ -35,33 +33,6 @@ var (
GoArch = runtime.GOARCH
)

// Deprecated: Use github.com/prometheus/client_golang/prometheus/collectors/version.NewCollector instead.
//
// NewCollector returns a collector that exports metrics about current version
// information.
func NewCollector(program string) prometheus.Collector {
return prometheus.NewGaugeFunc(
prometheus.GaugeOpts{
Namespace: program,
Name: "build_info",
Help: fmt.Sprintf(
"A metric with a constant '1' value labeled by version, revision, branch, goversion from which %s was built, and the goos and goarch for the build.",
program,
),
ConstLabels: prometheus.Labels{
"version": Version,
"revision": GetRevision(),
"branch": Branch,
"goversion": GoVersion,
"goos": GoOS,
"goarch": GoArch,
"tags": GetTags(),
},
},
func() float64 { return 1 },
)
}

// versionInfoTmpl contains the template used by Info.
var versionInfoTmpl = `
{{.program}}, version {{.version}} (branch: {{.branch}}, revision: {{.revision}})
Expand Down

0 comments on commit 6aadcf4

Please sign in to comment.