Commit Graph

8 Commits

Author SHA1 Message Date
beorn7 41ecb6c6b2 Improve the Metric.Equal and Metric.Before methods. 2015-05-06 11:42:41 +02:00
beorn7 0e0e6bff80 Rework the signature aka fingerprint functions.
Move everything over to a more expensive but less collision-prone way.
However, keep the old fingerprinting under the name "FastFingerprint"
to be used in the storage layer (where we need collision detection
anyway).
2015-05-05 18:02:21 +02:00
beorn7 cbe221c969 Switch to sync.Pool.
sync.Pool is after all faster than the home-made free list. Especially
under contention. To prove that, this commit also adds a benchmark for
concurrent fingerprint calculation.

Benchmark results:
(Run with -cpu=1,2,4. x-y -> x goroutines with GOMAXPROCS=y.)

benchmark                                     old ns/op     new ns/op     delta
BenchmarkMetricToFingerprintTripleConc4-4     320           138           -56.88%
BenchmarkMetricToFingerprintTripleConc8-4     314           141           -55.10%
BenchmarkMetricToFingerprintTripleConc4-2     344           264           -23.26%
BenchmarkMetricToFingerprintTripleConc2-4     331           256           -22.66%
BenchmarkMetricToFingerprintTripleConc8-2     338           263           -22.19%
BenchmarkMetricToFingerprintTripleConc1-4     599           505           -15.69%
BenchmarkMetricToFingerprintTripleConc4       553           493           -10.85%
BenchmarkMetricToFingerprintTripleConc2-2     327           292           -10.70%
BenchmarkMetricToFingerprintTripleConc8       554           496           -10.47%
BenchmarkMetricToFingerprintTripleConc2       555           501           -9.73%
BenchmarkMetricToFingerprintTripleConc1       554           509           -8.12%
BenchmarkMetricToFingerprintTripleConc1-2     551           513           -6.90%
2015-03-04 12:35:06 +01:00
beorn7 af21d456db Unify fingerprinting aka signature calculation.
This fixes https://github.com/prometheus/client_golang/issues/74 .

IT CHANGES THE FINGERPRINTING AND THEREFORE INVALIDATES EACH AND EVERY
PERSISTED FINGERPRINT (I.E. YOU HAVE TO WIPE THE STORAGE TO USE THIS).

This commit removes the LabelValuesToSignature function as it is used
nowhere (and broken in the way it is implemented right now).

Also, remove one more golint warning.
2015-03-03 17:55:37 +01:00
Bjoern Rabenstein d7f8eb1083 Change "Prometheus Team" to "The Prometheus Authors". 2015-02-02 15:14:36 +01:00
Bjoern Rabenstein 998774096c Make the collectorID independent of the desc order.
This is actually the intended behavior, and (as a nice side effect)
makes things cheaper to calculate.

Also, introduce a separator character to avoid hash collisions
(like label values {"ab","c"} vs {"a", "bc"}).

Apply the same principles to signature.go.

Change-Id: I607db544f278ed89684fe5fa11abdbc3e03d3061
2014-06-26 15:50:11 +02:00
Bjoern Rabenstein 5d40912fd2 Complete rewrite of the exposition library.
This rewrite had may backs and forths. In my git repository, it
consists of 35 commits which I cannot group or merge into reasonable
review buckets. Gerrit breaks fundamental git semantics, so I have to
squash the 35 commits into one for the review.

I'll push this not with refs/for/master, but with refs/for/next so
that we can transition after submission in a controlled fashion.

For the review, I recommend to start with looking at godoc and in
particular the many examples. After that, continue with a line-by-line
detailed review. (The big picture is hopefully as expected after
wrapping up the discussion earlier.)

Change-Id: Ib38cc46493a5139ca29d84020650929d94cac850
2014-06-17 14:08:22 +02:00
Bjoern Rabenstein e5dc0421cd Move signature.go and related tests to the model package.
The LabelsToSignature function is now used outside of the prometheus
package, too. Leaving it in the prometheuos package is misleading
design and will lead to circulat import chains soon.

Change-Id: If1ca442d4023b33b138cf79fee68e82ff2a355be
2014-04-25 20:48:16 +02:00