Add collect[] parameter (#699)

* Add `collect[]` parameter

* Add TODo comment about staticcheck ignored

* Restore promhttp.HandlerOpts

* Log a warning and return HTTP error instead of failing

* Check collector existence and status, cleanups

* Fix warnings and error messages

* Don't panic, return error if collector registration failed

* Update README
This commit is contained in:
Siavash Safi 2017-10-14 14:23:42 +02:00 committed by Ben Kochie
commit f3a7022602
4 changed files with 91 additions and 14 deletions

View file

@ -27,6 +27,10 @@ DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
MACH ?= $(shell uname -m)
DOCKERFILE ?= Dockerfile
# TODO: Remove deprecated and problematic InstrumentHandlerFunc usage.
STATICCHECK_IGNORE = \
github.com/prometheus/node_exporter/node_exporter.go:SA1019
ifeq ($(GOHOSTARCH),amd64)
# Only supported on amd64
test-flags := -race
@ -99,7 +103,7 @@ vet:
staticcheck: $(STATICCHECK)
@echo ">> running staticcheck"
@$(STATICCHECK) $(pkgs)
@$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)
build: $(PROMU)
@echo ">> building binaries"