From c2ed40c71c41f2600643a01223c9cc77f1ff0f77 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Fri, 19 Dec 2014 14:17:25 +0100 Subject: [PATCH 1/3] Update Go download path and enable curl redirects. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a09c6e7..09fdc0a 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ endif export GOARCH = $(subst x86_64,amd64,$(ARCH)) export GOPKG = go$(GO_VERSION).$(GOOS)-$(GOARCH)$(RELEASE_SUFFIX).tar.gz +export GOURL = http://golang.org/dl export GOROOT = $(BUILD_PATH)/root/go export GOPATH = $(BUILD_PATH)/root/gopath export GOCC = $(GOROOT)/bin/go @@ -57,7 +58,7 @@ $(BUILD_PATH)/root: $(BUILD_PATH) mkdir -vp $(BUILD_PATH)/root $(BUILD_PATH)/cache/$(GOPKG): $(BUILD_PATH)/cache - curl -o $@ http://go.googlecode.com/files/$(GOPKG) + curl -o $@ -L $(GOURL)/$(GOPKG) $(GOCC): $(BUILD_PATH)/root $(BUILD_PATH)/cache/$(GOPKG) tar -C $(BUILD_PATH)/root -xzf $(BUILD_PATH)/cache/$(GOPKG) From deef44ca73474a1f2d023be1ce01de6096690e3d Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Fri, 19 Dec 2014 14:06:14 +0100 Subject: [PATCH 2/3] Update used Go version from 1.2.1 to 1.4. --- .travis.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 235f8e2..ec0ff73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - 1.2.1 + - 1.4 script: - make -f Makefile diff --git a/Makefile b/Makefile index 09fdc0a..0d3689b 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ MAC_OS_X_VERSION ?= 10.8 BUILD_PATH = $(PWD)/.build -export GO_VERSION = 1.2.1 +export GO_VERSION = 1.4 export GOOS = $(subst Darwin,darwin,$(subst Linux,linux,$(OS))) ifeq ($(GOOS),darwin) From 7fcb2c594a974a01493e7923d094ee0ee21c5fbf Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Fri, 19 Dec 2014 13:54:04 +0100 Subject: [PATCH 3/3] Drain collector channel when returning prematurely. --- prometheus/registry.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/prometheus/registry.go b/prometheus/registry.go index cb108f5..65ea520 100644 --- a/prometheus/registry.go +++ b/prometheus/registry.go @@ -33,8 +33,8 @@ import ( dto "github.com/prometheus/client_model/go" - "compress/gzip" "code.google.com/p/goprotobuf/proto" + "compress/gzip" "github.com/prometheus/client_golang/_vendor/goautoneg" "github.com/prometheus/client_golang/model" @@ -424,6 +424,12 @@ func (r *registry) writePB(w io.Writer, writeEncoded encoder) (int, error) { } r.mtx.RUnlock() + // Drain metricChan in case of premature return. + defer func() { + for range metricChan { + } + }() + // Gather. for metric := range metricChan { // This could be done concurrently, too, but it required locking