Commit graph

138 commits

Author SHA1 Message Date
Matthias Rampke 7188ed4292
Add more tests for gauge increment/decrement
Validate the behavior for relative gauge events as per [the statsd type metric type documentatoin](https://github.com/statsd/statsd/blob/master/docs/metric_types.md#gauges).

Reaffirms #523.

Signed-off-by: Matthias Rampke <matthias@prometheus.io>
2024-01-15 22:44:07 +01:00
Sebastian Rabenhorst 4392beadc3
Added config to honor labels in mappings
Signed-off-by: Sebastian Rabenhorst <sebastian.rabenhorst@shopify.com>
2023-11-02 14:15:07 +01:00
kullanici0606 c246633aec add counter for dropped UDP packets. Remove unnecessary and misleading comment
Signed-off-by: kullanici0606 <yakup.turgut@btk.gov.tr>
2023-10-23 10:01:52 +03:00
kullanici0606 aaaf26c074 avoid making copies of slices since we need to minimize the time spent in packet read in order not to drop packets
Signed-off-by: kullanici0606 <yakup.turgut@btk.gov.tr>
2023-09-20 10:37:53 +03:00
kullanici0606 b0c6d983e1 fix udp metrics increment
Signed-off-by: kullanici0606 <yakup.turgut@btk.gov.tr>
2023-09-20 10:37:53 +03:00
kullanici0606 ccb3eb6277 remove unnecessary log
Signed-off-by: kullanici0606 <yakup.turgut@btk.gov.tr>
2023-09-20 10:37:53 +03:00
kullanici0606 03255bf218 process udp packets in a separate goroutine so that udp packets are not dropped
Signed-off-by: kullanici0606 <yakup.turgut@btk.gov.tr>
2023-09-20 10:37:53 +03:00
Sumesh Premraj 5123a1caa6 Convert line payload debug logs to string
Signed-off-by: Sumesh Premraj <sumeshpremraj@gmail.com>
2023-07-10 11:26:39 +02:00
Eddie Bracho fdc8b5f852 Add scale field to mapping config
This field allows configuring unit conversions in mappings. For example:

mappings:
- match: foo.latency_ms
  name: foo_latency_seconds
  scale: 0.001
- match: bar.processed_kb
  name: bar_processed_bytes
  scale: 1024

Signed-off-by: Eddie Bracho <eddiebracho@gmail.com>
2023-05-29 19:54:43 -07:00
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
Pedro Tanaka da06fabcb6
Use same error message
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-08-29 08:53:50 +02:00
Pedro Tanaka 83cec219c8
Checking conflict for gauges as well and refactoring into function
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-08-29 08:51:09 +02:00
Pedro Tanaka 31b05ef232
Fixing typo
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-08-26 11:58:41 +02:00
Pedro Tanaka c41fa101f5
Bring back test cases after rebase problem
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-08-26 11:57:57 +02:00
Pedro Tanaka 7afa060ce4
Fixing clash problem when counter clashes with previous registered histogram
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-08-26 11:40:22 +02:00
Pedro Tanaka 30c3e31574
Improving isolation of metric conflict test
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
2022-08-26 11:40:18 +02: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
Sandro Jijavadze 2ab624a917 fix flaky test gosched hack
Signed-off-by: Sandro Jijavadze <sandrojijavadze@protonmail.com>
2022-06-22 15:31:41 +04:00
Pedro Tanaka 6e341dd805
Fixing broken benchmark for mapper
Signed-off-by: Pedro Tanaka <pedro.stanaka@gmail.com>
2022-06-17 12:14:29 +02:00
Matthias Rampke d46243aa66
Update Year 2022-05-06 11:56:04 +00:00
Pedro Tanaka 0de518d3d5
Adding new metric to keep track of total relayed lines
* Adding new simple test to relay package
* Adding metric testing on relay
* Adding new metric to relay
* Adding new test section to check on metrics
* Fixing linting problems on new code
* Adding license headers on file

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-05-06 13:06:46 +02:00
Matthias Rampke 4b6983811e
Revert "New metric for total lines relayed"
Signed-off-by: Matthias Rampke <matthias@prometheus.io>
2022-05-06 10:50:13 +00:00
Pedro Tanaka fbf7837387
Fixing linting problems on new code
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-04-26 21:07:02 +02:00
Pedro Tanaka d015cda365
Adding new test section to check on metrics
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-04-22 14:58:21 +02:00
Pedro Tanaka 2d339b0853
Adding new metric to relay
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-04-21 11:47:19 +02:00
Pedro Tanaka 60742e1bd6
Adding metric testing on relay
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-04-21 11:43:58 +02:00
Pedro Tanaka 78dcd3b7b2
Adding new simple test to relay package
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
2022-04-21 08:27:16 +02:00
Matt Durham aadb43ed02 Use the instance registry instead of the prometheus.registry
Signed-off-by: Matt Durham <mattdurham@ppog.org>
2021-11-17 11:37:39 -05:00
Matthias Rampke 6c0283942c
Merge pull request #402 from agneum/389-allow-multiple-dashes
feat: handle multiple dashes in unmapped metrics (#389)
2021-10-26 13:13:52 +02: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
akartasov b6fc5ded9f
fix linter warnings: goimports, wsl
Signed-off-by: akartasov <agneum@gmail.com>
2021-10-24 00:13:53 +07:00
akartasov 2ab2c442cf
feat: handle double dashes in unmapped metrics (#389)
Signed-off-by: akartasov <agneum@gmail.com>
2021-10-23 23:53:47 +07:00
beorn7 4946fc865c Add deprecation note to pkg directory
Signed-off-by: beorn7 <beorn@grafana.com>
2021-10-13 14:40:09 +02:00
SuperQ ae26c506f5
Add metrics to relay
Add some metrics to the statsd relay.
* The number of StatsD packets relayed.
* The number lines that were too long to relay.

Also convert main.go to use promauto for metric registration.

Signed-off-by: SuperQ <superq@gmail.com>
2021-09-02 11:57:39 +02:00
SuperQ 0b84893d4a
Add statsd relay
Add a simple statsd packet output relay that buffers and forwards raw
statsd lines.
* Only supports UDP output.
* Has a hard-coded buffering timeout of 1 second.

Closes: https://github.com/prometheus/statsd_exporter/issues/95

Signed-off-by: SuperQ <superq@gmail.com>
2021-09-01 15:14:01 +02: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
Márk Sági-Kazár 04bc13d73c
refactor: use structured logging
Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
2021-06-09 14:44:55 +02: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
John Howard c5113b732c Update dependencies and drop large go-kit update
Pulling in the same changes as done in
https://github.com/prometheus/common/issues/255

Signed-off-by: John Howard <howardjohn@google.com>
2021-06-03 08:00:27 -07:00
royeo 393b4ca495 Fix comment
Signed-off-by: royeo <ljn6176@gmail.com>
2021-05-06 16:08:29 +08:00
Brian Akins a8f8067315 Use groupcache for LRU cache
Signed-off-by: Brian Akins <205350+bakins@users.noreply.github.com>
2021-04-28 12:15:19 -04: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
Matthias Rampke 5793e05795
Add additional tests for #365
testing more edge cases.

Signed-off-by: Matthias Rampke <matthias@prometheus.io>
2021-03-26 16:54:29 +00: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