- use MetricVec family instead of Metric
- dynamic label values instead of ConstLabels
- use dto.Metric to gain histrogram value in exporter_test
- remove hash calculations
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
It's idiomatic in go to keep code indentation due to nested loops to a
minimum. Decoupling the events handling function into its own function
makes it easier to read the code and test the behavior in isolation of
the channel handling. It's now also easily possible to process events
in parallel without having to touch actual business code.
Signed-off-by: Tobias Schmidt <tobidt@gmail.com>
* Quantile values for a Summary are now configurable.
* The default quantiles (DefObjectives) in the prometheus Go client library is
deprecated. This commit removes the reliance on it.
Signed-off-by: Harry Bagdi <harrybagdi@gmail.com>
The "packets" metric had heavily overloaded meaning for different
"outcomes", and would often be incremented multiple times, sometimes
even with a single (per-line) increment in one outcome corresponding to
multiple increments in another.
This removes the broken metric, and replaces it with separate total and
error counters for each level of processing. This allows monitoring the
network traffic handled separately from the samples incurred by it.
* Updated mappings to accept custom help text in YAML config
* Updated exporter to display configured help messages
* Update README to reflect aditional configurability
* Removed inaccurate comment
* Removed some cruft from a rebase
* Remove option flag
* Update NewExporter call signature to not take suffix boolean
* Update tests to reflect new behavior and signature
* Update documentation to reflect option flag removal
* add TCP StatsD listener support
* add listen-tcp flag to control UDP/TCP mode on same port
* statsdListenUDP/statsdListenTCP as string, and alias listen-address to listen-udp
* add stats for tcp error/line_too_long
* add test for TCP listener
Move addition of metric to "Elements" until after a successful registry
with prometheus, otherwise we'll continue to increment a metric which
isn't registered
There is no need to add the string to all event types as only Gauge
is compatible with inc/dec functionality. Removed valueStr from all
events and added a simple boolean to the Gauge event instead
Instead now we will send a warning message to the logs
and continue on with our day.
Also a guard has been added when we detect a channel has been
closed and the `Exporter.Listen` function will return out of
its loop vs always running. When a channel is closed there will
be no more data to consume, so this seems correct. It also allows
for a test to be written for the panic.
Datadog's format extensions allow attaching labels and tags to statsd
metrics, and are documented at
http://docs.datadoghq.com/guides/dogstatsd/#datagram-format
Additionally changes compare method in tests to reflect.DeepEqual, as
the tag maps don't sort deterministically, corrects an inversion in
displaying test failure cases, and treats an invalid sample value as 1
instead of throwing out the sample.