mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
Update vendoring of client_golang to 0.3.1.
This commit is contained in:
parent
ecf3449222
commit
5ed3bf2e4b
16
Godeps/Godeps.json
generated
16
Godeps/Godeps.json
generated
|
@ -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",
|
||||
|
|
15
Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature.go
generated
vendored
15
Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature.go
generated
vendored
|
@ -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
|
||||
|
|
38
Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature_test.go
generated
vendored
38
Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature_test.go
generated
vendored
|
@ -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)
|
||||
}
|
||||
|
|
2
Godeps/_workspace/src/github.com/prometheus/client_golang/text/parse_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/prometheus/client_golang/text/parse_test.go
generated
vendored
|
@ -385,7 +385,7 @@ request_duration_microseconds_count 2693
|
|||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i, scenario := range scenarios {
|
||||
|
|
Loading…
Reference in a new issue