statsd_exporter
statsd_exporter copied to clipboard
pkg/line: support DogStatsD v1.3 metric timestamp field (|T<unix_ts>)
Summary
DogStatsD protocol v1.3 adds an optional timestamp suffix to the metric datagram:
<name>:<value>|<type>|#<tags>|T<unix_timestamp>
Previously any datagram containing this field was silently dropped because T was not a recognised component prefix (hit the default branch → continue samples) and the 5-component guard rejected fully-formed v1.3 datagrams.
Changes
pkg/line/line.go: add a'T'case in the component switch that validates the Unix timestamp integer and ignores it (statsd_exporter does not propagate source timestamps to Prometheus — same approach as the v1.2|c:<container_id>field)- Raise the max-components guard from
5→8to accommodate all six possible v1.3 fields (value,type,@sample,#tags,|c:,|T:) without hitting a falsemalformed_componenterror pkg/line/line_test.go: five new test cases — counter, gauge, combined sampling+container+timestamp, and two malformed-timestamp cases
Tests
go test ./pkg/line/... # all pass
Fixes #680