Skip to content

Commit

Permalink
include ldflags for goreleaser + register new metric with version info
Browse files Browse the repository at this point in the history
  • Loading branch information
vilhelmprytz committed Jul 10, 2023
1 parent 3a21dae commit dc86ea7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@ before:
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- ldflags:
- -s
- -X github.com/prometheus/common/version.Version={{ .Version }}
- -X github.com/prometheus/common/version.Revision={{ .FullCommit }}
- -X github.com/prometheus/common/version.Branch={{ .Branch }}
- -X github.com/prometheus/common/version.BuildUser=actions@github
- -X github.com/prometheus/common/version.BuildDate={{ .Date }}
env:
- CGO_ENABLED=0
2 changes: 2 additions & 0 deletions areca_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ func main() {
kingpin.HelpFlag.Short('h')
kingpin.Parse()

prometheus.Register(version.NewCollector(exporter))

recordMetrics()

level.Info(logger).Log("msg", "Starting areca_exporter", "version", version.Info())
Expand Down

0 comments on commit dc86ea7

Please sign in to comment.