From 5ed3bf2e4bfb1e6f0ee13dd86516d4c6fb18c7bf Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 4 Mar 2015 13:42:00 +0100 Subject: [PATCH 1/2] Update vendoring of client_golang to 0.3.1. --- Godeps/Godeps.json | 16 ++++---- .../client_golang/model/signature.go | 15 +++----- .../client_golang/model/signature_test.go | 38 +++++++++++++++++++ .../client_golang/text/parse_test.go | 2 +- 4 files changed, 53 insertions(+), 18 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 485b64143..24946eef6 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -29,23 +29,23 @@ }, { "ImportPath": "github.com/prometheus/client_golang/extraction", - "Comment": "0.3.0", - "Rev": "dbbb6c9e1dbb3bf19d0f9a61baa852cbfcee1896" + "Comment": "0.3.1", + "Rev": "f688948916633c167d810a9548d4b775da43b0b0" }, { "ImportPath": "github.com/prometheus/client_golang/model", - "Comment": "0.3.0", - "Rev": "dbbb6c9e1dbb3bf19d0f9a61baa852cbfcee1896" + "Comment": "0.3.1", + "Rev": "f688948916633c167d810a9548d4b775da43b0b0" }, { "ImportPath": "github.com/prometheus/client_golang/prometheus", - "Comment": "0.3.0", - "Rev": "dbbb6c9e1dbb3bf19d0f9a61baa852cbfcee1896" + "Comment": "0.3.1", + "Rev": "f688948916633c167d810a9548d4b775da43b0b0" }, { "ImportPath": "github.com/prometheus/client_golang/text", - "Comment": "0.3.0", - "Rev": "dbbb6c9e1dbb3bf19d0f9a61baa852cbfcee1896" + "Comment": "0.3.1", + "Rev": "f688948916633c167d810a9548d4b775da43b0b0" }, { "ImportPath": "github.com/prometheus/client_model/go", diff --git a/Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature.go b/Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature.go index ab77ae847..cc77b192d 100644 --- a/Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature.go +++ b/Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature.go @@ -17,6 +17,7 @@ import ( "bytes" "hash" "hash/fnv" + "sync" ) // SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is @@ -28,7 +29,7 @@ var ( // cache the signature of an empty label set. emptyLabelSignature = fnv.New64a().Sum64() - hashAndBufPool = make(chan *hashAndBuf, 1024) + hashAndBufPool sync.Pool ) type hashAndBuf struct { @@ -37,19 +38,15 @@ type hashAndBuf struct { } func getHashAndBuf() *hashAndBuf { - select { - case hb := <-hashAndBufPool: - return hb - default: + hb := hashAndBufPool.Get() + if hb == nil { return &hashAndBuf{h: fnv.New64a()} } + return hb.(*hashAndBuf) } func putHashAndBuf(hb *hashAndBuf) { - select { - case hashAndBufPool <- hb: - default: - } + hashAndBufPool.Put(hb) } // LabelsToSignature returns a unique signature (i.e., fingerprint) for a given diff --git a/Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature_test.go b/Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature_test.go index be31998d6..7b3327d44 100644 --- a/Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature_test.go +++ b/Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature_test.go @@ -15,6 +15,7 @@ package model import ( "runtime" + "sync" "testing" ) @@ -216,3 +217,40 @@ func TestEmptyLabelSignature(t *testing.T) { t.Fatal("expected LabelsToSignature with empty labels not to perform allocations") } } + +func benchmarkMetricToFingerprintConc(b *testing.B, m Metric, e Fingerprint, concLevel int) { + var start, end sync.WaitGroup + start.Add(1) + end.Add(concLevel) + + for i := 0; i < concLevel; i++ { + go func() { + start.Wait() + for j := b.N / concLevel; j >= 0; j-- { + if a := metricToFingerprint(m); a != e { + b.Fatalf("expected signature of %d for %s, got %d", e, m, a) + } + } + end.Done() + }() + } + b.ResetTimer() + start.Done() + end.Wait() +} + +func BenchmarkMetricToFingerprintTripleConc1(b *testing.B) { + benchmarkMetricToFingerprintConc(b, Metric{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 1) +} + +func BenchmarkMetricToFingerprintTripleConc2(b *testing.B) { + benchmarkMetricToFingerprintConc(b, Metric{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 2) +} + +func BenchmarkMetricToFingerprintTripleConc4(b *testing.B) { + benchmarkMetricToFingerprintConc(b, Metric{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 4) +} + +func BenchmarkMetricToFingerprintTripleConc8(b *testing.B) { + benchmarkMetricToFingerprintConc(b, Metric{"first-label": "first-label-value", "second-label": "second-label-value", "third-label": "third-label-value"}, 15738406913934009676, 8) +} diff --git a/Godeps/_workspace/src/github.com/prometheus/client_golang/text/parse_test.go b/Godeps/_workspace/src/github.com/prometheus/client_golang/text/parse_test.go index 6b7adfff5..cc3e6470f 100644 --- a/Godeps/_workspace/src/github.com/prometheus/client_golang/text/parse_test.go +++ b/Godeps/_workspace/src/github.com/prometheus/client_golang/text/parse_test.go @@ -385,7 +385,7 @@ request_duration_microseconds_count 2693 }, }, }, - }, + }, } for i, scenario := range scenarios { From 34396f75ea6fba2a429d8ba43f23bbb6fb49ebfb Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 4 Mar 2015 13:50:58 +0100 Subject: [PATCH 2/2] Cut 0.12.0. --- CHANGELOG.md | 15 +++++++++++++++ VERSION | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86ddc8db7..754d85164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +## 0.12.0 / 2015-03-04 +* [CHANGE] Use client_golang v0.3.1. THIS CHANGES FINGERPRINTING AND INVALIDATES + ALL PERSISTED FINGERPRINTS. You have to wipe your storage to use this or + later versions. There is a version guard in place that will prevent you to + run Prometheus with the stored data of an older Prometheus. +* [BUGFIX] The change above fixes a weakness in the fingerprinting algorithm. +* [ENHANCEMENT] The change above makes fingerprinting faster and less allocation + intensive. +* [FEATURE] OR operator and vector matching options. See docs for details. +* [ENHANCEMENT] Scientific notation and special float values (Inf, NaN) now + supported by the expression language. +* [CHANGE] Dockerfile makes Prometheus use the Docker volume to store data + (rather than /tmp/metrics). +* [CHANGE] Makefile uses Go 1.4.2. + ## 0.11.1 / 2015-02-27 * [BUGFIX] Make series maintenance complete again. (Ever since 0.9.0rc4, or commit 0851945, series would not be archived, chunk descriptors would diff --git a/VERSION b/VERSION index af88ba824..ac454c6a1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.1 +0.12.0