Add build_info metric similar to the one of Prometheus itself
This commit is contained in:
parent
a59c71b505
commit
fc3931c924
3 changed files with 63 additions and 2 deletions
12
Makefile
12
Makefile
|
|
@ -13,6 +13,16 @@
|
|||
|
||||
VERSION := 0.12.0rc1
|
||||
TARGET := node_exporter
|
||||
GOFLAGS := -ldflags "-X main.Version=$(VERSION)"
|
||||
|
||||
REVISION := $(shell git rev-parse --short HEAD 2> /dev/null || echo 'unknown')
|
||||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'unknown')
|
||||
|
||||
REPO_PATH := "github.com/prometheus/node_exporter"
|
||||
LDFLAGS := -X main.Version=$(VERSION)
|
||||
LDFLAGS += -X $(REPO_PATH)/collector.Version=$(VERSION)
|
||||
LDFLAGS += -X $(REPO_PATH)/collector.Revision=$(REVISION)
|
||||
LDFLAGS += -X $(REPO_PATH)/collector.Branch=$(BRANCH)
|
||||
|
||||
GOFLAGS := -ldflags "$(LDFLAGS)"
|
||||
|
||||
include Makefile.COMMON
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue