Commit graph

487 commits

Author SHA1 Message Date
Matthias Rampke
64a51731f7
Quote all matchers in YAML examples
They can start with a * which makes YAML barf if not quoted. Instead of
figuring out individually what does and does not need to be quoted,
always quote.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-07-05 13:32:22 +00:00
Matthias Rampke
23ef5daeac
Reload on SIGHUP instead of watching the file
This is more portable (works on any system that has UNIX signals) and
removes the dependency on fsnotify, which doesn't compile on AIX. It
also reduces the probability of failed reloads due to partial writes.

Fixes #241.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-07-05 13:30:31 +00:00
Simon Pasquier
eb51631f33
Build ARM container images (#242)
It also updates the Circle CI configuration to use the
Prometheus orb.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-07-02 14:09:42 +02:00
Matthias Rampke
611dd8c60a
Merge pull request #239 from prometheus/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2019-06-24 11:07:18 +02:00
prombot
3494db2a67 makefile: update Makefile.common with newer version
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2019-06-23 00:01:27 +00:00
Björn Rabenstein
f2d3b9eb79
Merge pull request #237 from prometheus/beorn7/modules
Update prometheus/client_golang to v1.0.0
2019-06-21 15:01:10 +02:00
beorn7
ef5212ce06 Update prometheus/client_golang to v1.0.0
Signed-off-by: beorn7 <beorn@grafana.com>
2019-06-17 18:34:56 +02:00
Matthias Rampke
511836b7ff
Release 0.11.2
* Update changelog for #235
* Release 0.11.2
2019-06-14 15:32:48 +02:00
Matthias Rampke
bb448be4f4
Merge pull request #235 from seruman/master
add missing eventHandler to StatsDTCPListener
2019-06-14 15:29:29 +02:00
Selman Kayrancioglu
bb88165d52 add missing eventHandler to StatsDTCPListener
Signed-off-by: Selman Kayrancioglu <selman@peak.com>
2019-06-14 15:42:21 +03:00
Matthias Rampke
a276bacac9
Release 0.11.1
no changes, 0.11.0 had test issues.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-06-14 08:19:50 +00:00
Matthias Rampke
4653781f9b
Update Makefile.common for prometheus/prometheus#5658
should fix the build

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-06-13 13:33:29 +00:00
Matthias Rampke
70c227522f
Release 0.11.0
and add the missing changelog entry for #227

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-06-13 08:42:18 +00:00
Matthias Rampke
c3dc7b4b96
Merge pull request #231 from SpencerMalone/match_metric_type_tests
Add test for multiple explicit metric types.
2019-06-12 18:04:57 +02:00
Matthias Rampke
6f7cb49280
Merge pull request #232 from golopot/patch-1
Update links for DogStatsD in README.md
2019-06-12 11:52:42 +02:00
Matthias Rampke
38d62c39a6
Add #233 / #80 to changelog 2019-06-12 09:23:09 +00:00
Matthias Rampke
4f9843ad0d
Merge pull request #233 from cdambo/master
Use promhttp instead of http
2019-06-12 11:18:21 +02:00
golopot
5cea0077e4 Update links for DogStatsD in README.md
Signed-off-by: Chiawen Chen <golopot@gmail.com>
2019-06-11 19:22:43 +08:00
Chanan Damboritz
8f7676eaa9 Use promhttp instead of http
Signed-off-by: Chanan Damboritz <chanan@hiredscore.com>
Signed-off-by: Chanan Damboritz <cdambo@gmail.com>
2019-06-11 13:54:20 +03:00
SpencerMalone
7035e5e075 Add test for multiple explicit metric types.
Signed-off-by: SpencerMalone <malone.spencer@gmail.com>
2019-06-07 20:11:32 -04:00
Matthias Rampke
5832aa9bcf
Merge pull request #227 from claytono/event-queuing
Add internal event queuing and flushing
2019-06-07 15:50:25 +02:00
Clayton O'Neill
091bf99641
Update event queue metric name to be more descriptive.
Co-Authored-By: Matthias Rampke <mr@soundcloud.com>
Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-06-07 09:01:20 -04:00
Matthias Rampke
2e5c38204a
Release 0.10.6
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-06-07 08:58:01 +00:00
Matthias Rampke
95e376a40b
Merge pull request #230 from prometheus/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2019-06-07 08:49:14 +02:00
prombot
1d21cdcc1e makefile: update Makefile.common with newer version
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2019-06-07 00:02:26 +00:00
Matthias Rampke
59056c097a
update changelog for #229 2019-06-06 12:34:05 +00:00
Matthias Rampke
8551a65827
Merge pull request #229 from andy-paine/make-mapper-cache-respect-metric-type
Make mapper cache respect metric type
2019-06-06 14:31:58 +02:00
Andy Paine
0135b40c08 Make mapper cache respect metric type
- Statsd allows users to provide a metric with the same name but
  differing types (counter, gauge, timer)
- The exporter allows this by letting users specify a
  "match_metric_type" in the mapping config
- However the mapper cache does not look at the metric type so it would
  return a MetricMapperCacheResult for the type of the first metric with
that name that the exporter saw
- Add MetricType to the signature for the cache and format the metric
  name with the type to provide unique keys for a metric with the same
name but differing type

Signed-off-by: Andy Paine <andy.paine@digital.cabinet-office.gov.uk>
2019-06-06 11:33:58 +01:00
Clayton O'Neill
c7e76967c8
Add internal event queuing and flushing
At high traffic levels, the locking around sending on channels can cause
a large amount of blocking and CPU usage.  These adds an event queue
mechanism so that events are queued for short period of time, and
flushed in batches to the main exporter goroutine periodically.

The default is is to flush every 1000 events, or every 200ms, whichever
happens first.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-06-04 06:57:48 -04:00
Matthias Rampke
50d5932124
Merge pull request #223 from claytono/rework-registry
Rework metric registration and tracking
2019-06-04 10:34:13 +02:00
Clayton O'Neill
f6f1d7f071
Remove redundant code in counter inc test
Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-31 08:38:16 -04:00
Clayton O'Neill
a241eb0b69
Remove vector cleanup from registry
This was attempting to clean up any vectors that no longer have metrics
associated with them.  Unfortunately this isn't really possible because
the prometheus client registry allows the second registration of the
same metric, and then throws an error when gathering the metrics.

Another options would be to unregister the metric with the client
library, but that's not implemented for unchecked collectors.

Unfortunately this means that if we have a lot of metrics with differing
label sets appearing and disappearing, that we'll leak some amount of
memory for vectors that are never used again, but this is the way the
old metric tracking code worked also.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-31 08:38:16 -04:00
Clayton O'Neill
680eb0e826
Add additional tests
This adds two tests.

The first test is to validate that two successive counter events will
increment a counter.  This is more about ensuring we can look up the
same metric twice in a row than checking increment functionality.

The second test verifies that the hashLabels function returns different
results when labels are changed.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-31 08:38:16 -04:00
Clayton O'Neill
f6c0dd965b
Remove dead code
This removes all the code that the new registry code replaces.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-31 08:38:16 -04:00
Clayton O'Neill
7c30120dbc
Rework metric registration and tracking
This reworks/rewrites the way that metric registration and tracking is
handled across all of statsd_exporter.  The goal here is to reduce
memory and cpu usage, but also to reduce complexity by unifying metric
registration with the ttl tracking for expiration.

Some high level notes:

* Previously metric names and labels were being hashed three times for
every event accepted: in the container code, the save label set code and
again in the prometheus client libraries.  This unifies the first two
and caches the results of `GetMetricWith` to avoid the third.

* This optimizes the label hashing to reduce cpu overhead and memory
allocations.  The label hashing code previously showed up high on all
profiling done for both CPU and memory allocations

Using the BenchmarkExporterListener benchmark, the improvement looks
like this.

Before:
cpu: 11,341,797 ns/op
memory allocated: 1,731,119 B/op
memory allocations: 58,028 allocs/op

After:
cpu: 7,084,651 ns/op
memory allocated: 906,556 B/op
memory allocations: 42,026 allocs/op

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-31 08:38:15 -04:00
Clayton O'Neill
7a107f899f
Add benchmark for exporter listener
Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-31 08:38:15 -04:00
Matthias Rampke
d74922e0fd
Merge pull request #226 from simonpasquier/use-org-context
Use Circle CI's org context
2019-05-31 08:47:05 +00:00
Simon Pasquier
83cd28067a Use Circle CI's org context
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-05-29 18:00:06 +02:00
Matthias Rampke
bfa30a94b2
Merge pull request #225 from jeamland/add_label_test
Add a test for adding labels from mapper configuration.
2019-05-28 08:26:08 +00:00
Benno Rice
f12451ee5b Add a test for adding labels from mapper configuration.
Signed-off-by: Benno Rice <benno@jeamland.net>
2019-05-28 10:06:17 +10:00
Matthias Rampke
09c2603f4b
Update changelog for #224, release 0.10.5
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-05-27 09:09:59 +00:00
Matthias Rampke
56a091a693
Merge pull request #224 from ptqa/master
Fix inconsistent label cardinality error
2019-05-27 09:06:29 +00:00
Tony Nyurkin
7d6244987a Fix inconsistent label cardinality error
Signed-off-by: Tony Nyurkin <ptqa@users.noreply.github.com>
2019-05-24 14:26:17 +03:00
Matthias Rampke
b333ecaacc
Add changelog for #221 and release 0.10.4
Reverting #218 due to race condition issue #220

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-05-20 08:35:36 +00:00
Matthias Rampke
3abf21e053
Merge pull request #221 from prometheus/revert-218-handlepacket-optimization
Revert "Reduce memory allocations in handlePacket"
2019-05-20 08:34:09 +00:00
Matthias Rampke
26e9d482db
Revert "Reduce memory allocations in handlePacket" 2019-05-20 08:20:19 +00:00
Matthias Rampke
471b28dc21
Update changelog for #217, #218, #219 and release
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-05-17 13:51:13 +00:00
Matthias Rampke
c9004f8f3f
Merge pull request #219 from claytono/optimize-label-handling
Optimize label sorting
2019-05-17 13:47:03 +00:00
Matthias Rampke
4e64da2a41
Merge pull request #218 from claytono/handlepacket-optimization
Reduce memory allocations in handlePacket
2019-05-17 13:38:56 +00:00
Matthias Rampke
27d9273107
Merge pull request #217 from claytono/emn-optimization
Convert escapeMetricName to use strings.Builder
2019-05-17 13:38:09 +00:00