This PR introduces the first step in refactoring the event handling system to better
support multiple values in a single event, which will help reduce allocations when
processing events. This is part of a larger effort to improve performance and reduce
memory allocations in the statsd exporter.
Changes:
- Add new `MultiValueEvent` interface that supports multiple values per event
- Add `MultiObserverEvent` implementation for handling multiple observations
- Add `ExplodableEvent` interface for backward compatibility
- Add `Values()` method to existing event types
- Add comprehensive tests for new interfaces and implementations
This change is the foundation for future improvements that will:
1. Move explosion logic to a dedicated package
2. Update the line parser to use multi-value events
3. Modify the exporter to handle multi-value events directly
4. Eventually remove the need for event explosion
The changes in this PR are backward compatible and don't affect existing functionality.
Relates to #577
Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
The line
```
|h|#consumer:Kafka::SharedConfigurationConsumer,topic:shared_configuration_update,partition:1,consumer_group:tc_rc_us
```
caused a panic because the line parsing _first_ splits by `:` and then failed to
find a `|` to split on.
Check that we get at least two "line parts" (i.e. splits around `|`) when we
expect them, and if not, gracefully reject the line instead of crashing.
Fixes#572.
Signed-off-by: Matthias Rampke <matthias@prometheus.io>
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>
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>
* 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>
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>
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>