Commit graph

45 commits

Author SHA1 Message Date
Gabriel Antunes 24e2fc9980 Making mapperConfigDefaults and metricObjective public, so that Grafana Agent can instantiate MetricMapper without using InitFromYAMLString directly.
Signed-off-by: Gabriel Antunes <g.amaral.antunes@gmail.com>
2023-03-15 16:34:31 -06:00
Pedro Tanaka f77011fd34
Allow creation of native histograms
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-12-06 09:49:24 +01:00
Matthias Rampke af84364004
Merge pull request #453 from prometheus/mr/guard-logger-fsm
mapper: Make sure we have a logger before backtracking check
2022-07-29 15:06:37 +00:00
inosato b43a60e9c8 Remove ioutil
Signed-off-by: inosato <si17_21@yahoo.co.jp>
2022-07-29 23:39:29 +09:00
Matthias Rampke bc43c5606d
mapper: Make sure we have a logger before backtracking check
The FSM backtracking detection issues a log line. Make sure there is a
non-nil logger before doing that.

Avoids the crash in prometheus/graphite_exporter#197.

Signed-off-by: Matthias Rampke <matthias@prometheus.io>
2022-07-29 11:46:57 +00:00
akartasov b60989291b
feat: enable more linters and fix warnings (#364)
Signed-off-by: akartasov <agneum@gmail.com>
2021-10-24 21:27:31 +07:00
davinlu 6329577a6b refactor: replace level pkg
Signed-off-by: davinlu <davinlu@tencent.com>
2021-09-01 18:55:45 +08:00
Evan Van Dam abb7ec0afb allow multiple dashes in StatsD metric names
Signed-off-by: Evan Van Dam <evan.vandam@wonolo.com>
2021-06-17 09:43:40 -07:00
Mark Sagi-Kazar 278a862099
refactor: use go-kit logger instead of deprecated common log package
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-06-07 16:00:08 +02:00
Matthias Rampke a8c09aaa97
Merge pull request #365 from glightfoot/segment-numbers
Support metric name segments starting with numbers
2021-03-26 18:20:30 +01:00
glightfoot a197834f64 Add comments about thread-safety
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-19 14:13:03 -05:00
glightfoot 8b306c8c76 remove noop cache, add helper function for tests
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-19 14:08:53 -05:00
glightfoot 0c4a66e6a1 rework metricLineRE to support matching segments that start with a number
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-07 11:21:48 -05:00
glightfoot 940e653ea6 cleanup
Signed-off-by: glightfoot <glightfoot@rsglab.com>
2021-02-06 23:21:49 -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 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
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
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 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 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
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 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
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
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
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 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 c10e80c44b
optimizations
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
2018-10-03 16:31:00 -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 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
Renamed from mapper/mapper.go (Browse further)