Commit graph

138 commits

Author SHA1 Message Date
glightfoot aa529c8884 rename mapper_cache to mappercache
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-06 23:27:11 -05:00
glightfoot 940e653ea6 cleanup
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-06 23:21:49 -05:00
glightfoot 32c612d5e8 add license
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-06 23:03:46 -05:00
glightfoot de9a51c863 fix TestMultipleMatches mapping indent
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-06 23:00:06 -05:00
glightfoot 0099df7f71 move lru and rr mapper caches to their own package and make mapper_cache a better an interface for implementing externally`
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-06 22:50:17 -05:00
glightfoot f8bba00868 format and clarify alias type comment
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-01-28 14:24:41 -05:00
glightfoot 66a63a8c1f use summary options defaults in registry
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-01-28 14:16:40 -05:00
glightfoot 58aed41ff2 remove deprecated fields from mapper defaults config
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-01-28 13:59:42 -05:00
glightfoot 06411336c7 add support for setting histogram_options and summary_options in defaults
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-01-28 13:58:52 -05:00
bakins 709c0da81b Use a Parser interface to allow alternate implementations
Signed-off-by: bakins <brian@akins.org>
2020-12-10 13:17:46 -05:00
Robert Fratto b5deeda251 Pass around custom registry for registering exporter metrics
Importers of pkg/exporter may not want for series to be imported into
the default registry. This commit makes it possible to provide a custom
registry for metrics registration.

Signed-off-by: Robert Fratto <robertfratto@gmail.com>
2020-11-20 14:14:14 -05:00
bakins 4acb05aa89 Use an interface for Registry so we may have multiple implementations
Signed-off-by: bakins <brian@akins.org>
2020-10-22 10:08:57 -04:00
Matthias Rampke da85f9d207
Merge pull request #335 from shmsr/dup-init-vars
Avoid double initialization of variables
2020-09-07 09:38:12 +02:00
Matthias Rampke 477d566101
Merge pull request #334 from shmsr/error-small-case
Error strings shouldn't be capitalized
2020-09-07 09:34:11 +02:00
subham sarkar 4c0e26bfa1 Avoid unnecessary initialization of variables
This commit fixes the case when the metric is not present in rm (registered metric) then LastRegisteredAt and TTL are initialized twice. Firstly, LastRegisteredAt is initialized with the time.Time's zero value and then with clock.Now(). Plus, TTL is initialized with the same value twice.

Signed-off-by: subham sarkar <subham.sarkar@guavus.com>
2020-09-06 16:49:25 +05:30
subham sarkar 2c4cda7fb3 Change casing of error messages
Error messages shouldn't be capitalized.

Signed-off-by: subham sarkar <subham.sarkar@guavus.com>
2020-09-06 16:33:18 +05:30
subham sarkar d93907009c Use prometheus.Gauge interface instead of prometheus.Counter
Signed-off-by: subham sarkar <subham.sarkar@guavus.com>
2020-09-04 20:14:32 +05:30
glightfoot 6942b5a4f3 move to line parser struct and option functions
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-08-10 12:44:23 -04:00
glightfoot db25b1d658 add line tests for disabling individual tag formats
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-07-28 13:30:34 -04:00
glightfoot 3f3ab23359 add globals for disabling individual tag parsing formats
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-07-28 13:29:06 -04:00
Matthias Rampke 36de8c9e12
Merge pull request #315 from glightfoot/signalfx
[268] Support SignalFx Tags
2020-06-26 17:08:49 +02:00
glightfoot 15eece3cf8 rename events for consistency
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-22 14:53:52 -04:00
glightfoot 9faa4898de abort parsing tags if malformed signalfx format, add tests
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-19 14:40:26 -04:00
glightfoot 4f7abe5226 Merge branch 'master' of github.com:prometheus/statsd_exporter into signalfx 2020-06-19 09:05:10 -04:00
Matthias Rampke ed37775e02
Merge pull request #309 from prometheus/mr/issue-256
Allow single-letter components in metric names
2020-06-19 14:15:01 +02:00
glightfoot 32f1677f81 add signalfx tag parsing
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-16 16:32:59 -04:00
glightfoot 4a64979563 move mapping and mapper_defaults into their own files with their unmarshalers
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-16 07:46:53 -04:00
glightfoot 1444824911 fix yaml tags
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-15 18:47:17 -04:00
glightfoot bdd4a76348 add more tests for metric type
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-15 18:46:20 -04:00
glightfoot 77277a5150 support deprecated timer_type in configs
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-15 18:41:16 -04:00
glightfoot 32e9e58e32 Rename timer to observer in mapper
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-15 17:26:20 -04:00
glightfoot d95a53553e change metric labels to observer
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-15 10:14:11 -04:00
glightfoot 374d202daa rename TimerEvent to ObserverEvent
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-12 09:25:51 -04:00
glightfoot 5c0b206f6e add support for histograms and distributions without unit conversion
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2020-06-11 10:56:36 -04:00
Matthias Rampke 44ae8f557c
Allow single-letter components in metric names
They are valid. Fixes #256.

Signed-off-by: Matthias Rampke <matthias@prometheus.io>
2020-05-29 08:09:46 +00:00
Matthias Rampke 3908609918
Merge pull request #305 from chai-nadig/chai/log-ingested-metrics
Log Ingested Lines
2020-05-29 08:57:26 +02:00
Chai Nadig d804941a18 Set Flush Interval on EventQueue
Signed-off-by: Chai Nadig <chaitanya.nadig@gmail.com>
2020-05-14 00:03:34 -07:00
Chai Nadig cc10478f61 reset event.go
Signed-off-by: Chai Nadig <chaitanya.nadig@gmail.com>
2020-05-13 23:58:24 -07:00
Chai Nadig 4eac64eb59 log proto with msg
Signed-off-by: Chai Nadig <chaitanya.nadig@gmail.com>
2020-05-13 23:58:24 -07:00
Chai Nadig a75e588cf0 Log Ingested Lines
Signed-off-by: Chai Nadig <chaitanya.nadig@gmail.com>
2020-05-13 23:58:24 -07:00
Frank Davidson 5ec58a32c2 squash! Updated structs and tests.
squash! Updated structs and tests.

Updated structs and tests.

Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
Signed-off-by: Frank Davidson <frank_davidson@manulife.com>
2020-04-09 11:44:13 -04:00
Frank Davidson 4b3b9ba207 Added license.
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
2020-04-08 15:30:01 -04:00
Frank Davidson 16b6f95c96 removed ~
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
2020-04-08 15:29:55 -04:00
Frank Davidson a455a8ad64 hopefully now linux
Signed-off-by: Frank Davidson <davidfr@americas.manulife.net>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
2020-04-08 15:29:54 -04:00
Frank Davidson d55b42eabb :Issue 234: Split into reusable packages.
Signed-off-by: Frank Davidson <frank_davidson@manulife.com>
Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
2020-04-08 15:29:49 -04:00
Matthias Rampke 60fbaf5e27
Merge pull request #281 from bakins/random-replacement
Add random replacement mapper cache
2020-03-05 10:25:15 +01:00
bakins 90e247b091 Add random replacement cache
Signed-off-by: bakins <brian@akins.org>
2020-03-04 12:26:59 -05:00
Thomas Gummerer dae5d782a6 allow setting granularity for summary metrics
The Go client for prometheus aggregates summary metrics over 10
minutes by default, in 5 buckets.  This is not always the behaviour we
want.

Allow tweaking those settings in `statsd_exporter`, so we can
aggregate summary metrics over more or less time, with more or fewer
buckets, and set the cap for the bucket as well.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
2020-02-18 18:04:38 +00:00
Thomas Gummerer 80b77513a6 create sub-hierarchies for summary and histogram options
Currently the Buckets and Quantiles settings are top level settings per metric
in the yaml.  In a subsequent commit we're going to allow adding more such
options for summaries, at which point having them all at the top level gets
confusing.

Split the options out into separate hierarchies to allow adding more options,
without adding confusion.  We preserve backwards compatibility by still
accepting the old option, but warning when it is present.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
2020-02-18 18:04:27 +00:00
bakins e60f77df30 Move escapeMetricName to mapper
Signed-off-by: bakins <brian@akins.org>
2020-01-16 11:20:37 -05:00
Brian Akins b234e1dd4e Use correct name when multiple names match same FSM match
Signed-off-by: Brian Akins <brian@akins.org>
2020-01-11 07:05:20 -05:00
Matthias Rampke 7e6d394af0
Make mapper cache metric names more specific
cf. https://github.com/prometheus/statsd_exporter/pull/282#issuecomment-573031514

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2020-01-10 14:32:16 +00:00
Matthias Rampke ac3e901f19
Rename mapping cache length metric
The mapper package can be used outside the statsd exporter, so it is
better to use generic names here.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2020-01-10 13:10:03 +00:00
bakins 4b69da2d03 mapper cache: Add cache metrics for total gets and hits
Add metrics to record mapper cache hits and total gets.

Signed-off-by: bakins <brian@akins.org>
2020-01-03 16:46:58 -05:00
bakins e60a0b6d00 Use string concatenation rather than Sprintf
Signed-off-by: bakins <brian@akins.org>
2019-12-31 16:40:33 -05:00
Joaquín Fernández Campo 84657e85ec Updated docs and added good/bad example yaml
Signed-off-by: Joaquin Fernandez Campo <jfcampo@gmail.com>
2019-11-26 10:01:29 +01: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
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
SpencerMalone 35d1a99592 Adding mapping cache
Signed-off-by: SpencerMalone <malone.spencer@gmail.com>
2019-04-26 18:00:39 -04:00
Matthias Rampke 485b28a9ff
Add missing license header
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-04-18 10:12:50 +00:00
Simon Pasquier 8f56cc811d *: add staticcheck target back
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-01-04 15:26:57 +01:00
Ivan Mikheykin 699c11ca11 Rework tests to not depend on actual wall clocks
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
2018-12-19 08:24:25 +03:00
Ivan Mikheykin d1b2dd47a8 TTL expiration tests, README update
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
2018-12-18 09:46:05 +03:00
Ivan Mikheykin e1a3a5fc32 Configured ttl value for stale metrics
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
2018-12-18 08:39:23 +03:00
Wangchong Zhou d0ad532fa1
fix: don't let captured fields being overwritten by backtracking
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-12-05 11:42:34 -08:00
Matthias Rampke e5734e34e9
Copy edit comments in fsm/formatter
Fixing a typo and language.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2018-10-10 21:31:51 +00:00
Matthias Rampke 97f71db21b
Put in-line image on its own paragraph
Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2018-10-10 21:24:08 +00:00
Matthias Rampke 9fc976d906
Copy edits in FSM README
Format quote as such, capitalize FSM.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2018-10-10 21:22:53 +00:00
Wangchong Zhou 4d9ce8c70a
add readmes
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-10-04 10:55:33 -07:00
Wangchong Zhou c10e80c44b
optimizations
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-10-03 16:31:00 -07:00
Wangchong Zhou 699fa13c8c
add benchmark test to ci
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-28 14:42:09 -07:00
Wangchong Zhou fcf11f02e5
promote formatLabels to mapper package
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-28 14:03:19 -07:00
Wangchong Zhou 5262b2904c
tidy up and use go benchmark
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-28 12:58:25 -07:00
Wangchong Zhou 6d709d52c1
gofmt
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-24 16:46:16 -07:00
Wangchong Zhou a0681a0cd2
more perf test
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-24 16:08:08 -07:00
Wangchong Zhou a8dcc589e5
add more perf test
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-24 13:36:43 -07:00
Wangchong Zhou f387766cc2
cleanup and add comments
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-24 13:36:08 -07:00
Wangchong Zhou 668e31e5f1
license header
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-21 18:13:23 -07:00
Wangchong Zhou 5e1df60d22
abstract dumpFsm
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-21 18:11:00 -07:00
Wangchong Zhou e634997791
move fsm to sepeare pkg
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-21 18:10:51 -07:00
Wangchong Zhou a751c0c091
cleanup
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-13 12:23:59 -07:00
Wangchong Zhou 9ebab25dfa
ordering
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-13 12:12:41 -07:00
Wangchong Zhou c2742aa299
implement backtrack
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-12 18:18:12 -07:00
Wangchong Zhou dad04e9c8b
detect backtracking
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-12 14:44:07 -07:00
Wangchong Zhou bfe23298aa
replace glob matching
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-11 17:34:19 -07:00
Wangchong Zhou 825b734b3e
Implement "fsm" match type
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-09-10 12:04:44 -07:00
Matthias Rampke d9f305b6f2
Inject the mappings count metric into the library package
so that it can be initialized with an exporter-specific name.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2018-08-14 09:31:38 +00:00
Matthias Rampke 40a13e604f
Move mapper -> pkg/mapper
to make clear that this is meant to be used elsewhere

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2018-08-14 09:20:00 +00:00