Commit graph

435 commits

Author SHA1 Message Date
Clayton O'Neill
d143398343
Optimize label sorting
Previously we were sorting labels in every container to build a map key,
but also when generating the hash key by calling the `LabelsToSignature`
method.  This moves the sorting to be done early in the event processing
then passes the sorted label array around.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-16 17:17:09 -04:00
Clayton O'Neill
732be39b4b
Add benchmark for hashNameAndLabels
Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-16 17:17:09 -04:00
Clayton O'Neill
4cf6f74dc3
Reduce memory allocations in handlePacket
This converts the byte buffer to a string by casting and parses the
string by looping over it instead of calling Split.

This usage of unsafe is taken from the strings.Builder package here:
cb5c82bc3d/src/strings/builder.go (L47)

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-16 16:35:32 -04:00
Clayton O'Neill
98da6f7057
Convert escapeMetricName to use strings.Builder
This converts escapeMetricName to use strings.Builder instead of
allocating a byte array, filling it and then converting it to a string.
This also optimizes for the case where the metricName is already valid,
and in that case, it just returns the original string.

This reduces memory allocations from 2 per call to 1 per call in the
case when the string does need to be escaped, and reduces it to zero
memory allocations when the string is already valid.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-16 09:28:35 -04:00
Matthias Rampke
a294491e0b
Resolve merge conflicts of #198 with #212 and #213
In #198 the signature for setting up the exporter changed slightly, a
change that #212 and #213 didn't have. This doesn't change anything
substantial.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-05-15 13:21:04 +00:00
Matthias Rampke
f502171bdc
Merge pull request #216 from claytono/conflicting-histogram-fix
Check for histogram conflict on main name
2019-05-15 13:20:11 +00:00
Matthias Rampke
8cc291f419
Release v0.10.0
* [CHANGE] Do not run as root in the Docker container by default ([#202](https://github.com/prometheus/statsd_exporter/pull/202))
* [FEATURE] Add metric for count of events by action ([#193](https://github.com/prometheus/statsd_exporter/pull/193))
* [FEATURE] Add metric for count of distinct metric names ([#200](https://github.com/prometheus/statsd_exporter/pull/200))
* [FEATURE] Add UNIX socket listener support ([#199](https://github.com/prometheus/statsd_exporter/pull/199))
* [FEATURE] Accept Datadog [distributions](https://docs.datadoghq.com/graphing/metrics/distributions/) ([#211](https://github.com/prometheus/statsd_exporter/pull/211))
* [ENHANCEMENT] Add a health check to the Docker container ([#182](https://github.com/prometheus/statsd_exporter/pull/182))
* [ENHANCEMENT] Allow inconsistent label sets ([#194](https://github.com/prometheus/statsd_exporter/pull/194))
* [ENHANCEMENT] Speed up sanitization of metric names ([#197](https://github.com/prometheus/statsd_exporter/pull/197))
* [ENHANCEMENT] Enable pprof endpoints ([#205](https://github.com/prometheus/statsd_exporter/pull/205))
* [ENHANCEMENT] DogStatsD tag parsing is faster ([#210](https://github.com/prometheus/statsd_exporter/pull/210))
* [ENHANCEMENT] Cache mapped metrics ([#198](https://github.com/prometheus/statsd_exporter/pull/198))
* [BUGFIX] Fix panic if a mapping resulted in an empty name ([#192](https://github.com/prometheus/statsd_exporter/pull/192))
* [BUGFIX] Ensure that there are always default quantiles if using summaries ([#212](https://github.com/prometheus/statsd_exporter/pull/212))
* [BUGFIX] Prevent ingesting conflicting metric types that would make scraping fail ([#213](https://github.com/prometheus/statsd_exporter/pull/213))

With #192, the count of events rejected because of negative counter increments has moved into the `statsd_exporter_events_error_total` metric, instead of being lumped in with the different kinds of successful events.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-05-15 13:09:41 +00:00
Matthias Rampke
228a969b1a
Add changelog entry for #198
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-05-15 13:06:04 +00:00
Matthias Rampke
698bcdf8c3
Merge pull request #198 from SpencerMalone/mapping-cache
Adding mapping cache
2019-05-15 13:05:00 +00:00
Clayton O'Neill
cce95f6980
Check for histogram conflict on main name
While it doesn't report it as a metric, when collecting, the registry
considers the base metric name to below to the histogram that's
registered.  This means that we need to prevent other metrics from
registering anything under this name, in addition to checking for the
bucket, sum and count suffixes.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-15 09:04:19 -04:00
Matthias Rampke
a42de85289
Add changelog entry for #213
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-05-15 11:22:17 +00:00
Matthias Rampke
04b7b71a2a
Merge pull request #213 from claytono/conflicting-metrics-test
Add checking for conflicting metrics
2019-05-15 11:20:56 +00:00
Clayton O'Neill
3dcad090b3
Add test cases for conflicting metrics with labels
Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-15 06:46:11 -04:00
Matthias Rampke
24e288a3a4
Merge pull request #214 from prometheus/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2019-05-15 07:40:06 +00:00
Ben Kochie
0eadae3ca7
Remove obsolete release tool.
Signed-off-by: Ben Kochie <superq@gmail.com>
2019-05-15 02:07:49 +02:00
prombot
7514e37e5b makefile: update Makefile.common with newer version
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2019-05-15 00:01:34 +00:00
Clayton O'Neill
9f1c6b81a5
Add checking for conflicting metrics
This adds sanity checking before registering a metric to ensure that the
metric isn't already registered under an existing name.  This prevents
the exporter from getting into a state where it has accepted and
registered conflicting metrics, and then cannot report the metrics it
has collected.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-14 18:33:49 -04:00
Matthias Rampke
f08bf14965
Update changelog for #210, #211, #212
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-05-14 16:24:33 +00:00
Matthias Rampke
bee73cbb9e
Merge pull request #211 from claytono/add-distributions
Add support for Datadog distribution type
2019-05-14 16:23:07 +00:00
Matthias Rampke
d7eb1edeed
Merge pull request #210 from claytono/tag-parsing-optimizations
Tag parsing optimizations
2019-05-14 16:18:37 +00:00
Matthias Rampke
f1c0052ce7
Merge pull request #212 from vsakhart/quantile_fix
Add default quantiles for summaries if no mapping file exists
2019-05-14 16:14:15 +00:00
Vitaliy Sakhartchouk
cddeb87405 Add default quantiles for summaries if no mapping file exists
Signed-off-by: Vitaliy Sakhartchouk <vsakhart@github.com>
2019-05-13 17:14:42 -07:00
Clayton O'Neill
04bba78d61
Add support for Datadog distribution type
This adds the ability to accept Datadog's distribution type and treat it
like a histogram/summary.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-13 14:59:21 -04:00
Clayton O'Neill
a4faae262b
Replace Split with special purpose implementation
This improves performance from 3169ns/op to 2836 ns/op and drops one
allocation per op.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-13 13:32:25 -04:00
Clayton O'Neill
e3cdd85a09
Extract individual tag parsing into new function
Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-13 12:46:50 -04:00
Clayton O'Neill
a441eac07a
Replace SplitN w/special purpose implementation
This improves performance per call in the a-z case from around 5533
ns/op to 3169ns/op.  It also drops allocations per call from 57 to 31
in the a-z case.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-13 12:46:50 -04:00
Clayton O'Neill
052beaa3ac
Replace TrimPrefix w/special purpose implementation
On the a-z benchmark, this brings the ns/op down from 5658 to 5533.

Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-13 12:46:50 -04:00
Clayton O'Neill
9cd711ed3e
Add benchmark for tag parsing
Signed-off-by: Clayton O'Neill <claytono@github.com>
2019-05-13 12:46:49 -04:00
Matthias Rampke
4d0cb1992d
Merge pull request #208 from prometheus/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2019-05-06 09:19:31 +00:00
prombot
e82cf2444b makefile: update Makefile.common with newer version
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2019-05-04 00:01:58 +00:00
SpencerMalone
35d1a99592 Adding mapping cache
Signed-off-by: SpencerMalone <malone.spencer@gmail.com>
2019-04-26 18:00:39 -04:00
Matthias Rampke
54cf241044
Merge pull request #207 from simonpasquier/bump-golang-1.12
Bump Go version to 1.12
2019-04-26 09:43:27 +00:00
Simon Pasquier
7631485b0b *: bump Go version to 1.12
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-26 10:55:07 +02:00
Matthias Rampke
abb2ab04fb
Merge pull request #206 from prometheus/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2019-04-25 09:03:15 +00:00
Simon Pasquier
6fd7690961 Add .golangci.yml
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-25 09:58:12 +02:00
prombot
f1de314e14 makefile: update Makefile.common with newer version
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2019-04-25 00:01:46 +00:00
Matthias Rampke
0bd90aee34
Update changelog for #205
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-04-23 09:12:24 +00:00
Matthias Rampke
9963806a62
Merge pull request #205 from claytono/add-pprof
Add pprof for profiling
2019-04-23 09:01:09 +00:00
Matthias Rampke
ee653990e6
Update changelog and README for #199
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-04-23 08:47:32 +00:00
Matthias Rampke
e3d6050616
Merge pull request #199 from Kong/feat/unixgram-socket
Implement listener for Unixgram sockets
2019-04-23 08:44:11 +00:00
Wangchong Zhou
47b5ef9be0
Buffer signals channel
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2019-04-22 16:35:28 -07:00
Wangchong Zhou
383ee9bd3b
Add a signal handler to allow clean up of unixgram socket file
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2019-04-22 16:33:22 -07:00
Clayton O'Neill
024f9dc0aa
Add pprof for profiling
Signed-off-by: Clayton O'Neill <clayton@oneill.net>
2019-04-22 08:07:43 -04:00
Matthias Rampke
ece8a26a79
Merge pull request #203 from prometheus/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2019-04-18 10:26:33 +00:00
Matthias Rampke
485b28a9ff
Add missing license header
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-04-18 10:12:50 +00:00
prombot
88a12bc9b9 makefile: update Makefile.common with newer version
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2019-04-18 00:00:40 +00:00
Matthias Rampke
c3eb636525
Add changelog for #202
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-04-17 15:25:44 +00:00
Matthias Rampke
0766e70e43
Merge pull request #202 from prometheus/superq/docker_user
Don't run docker container as root
2019-04-17 15:24:37 +00:00
Ben Kochie
38df95f440
Don't run docker container as root
Run statsd_exporter as `nobody`.

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-04-17 17:04:19 +02:00
Matthias Rampke
f0feef950b
Add changelog entry for #200
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-04-16 13:17:11 +00:00