elastic / beats

:tropical_fish: Beats - Lightweight shippers for Elasticsearch & Logstash
https://www.elastic.co/products/beats
Other
12.05k stars 4.89k forks source link

Metricbeat – Statsd Module issue with count value when using timer/histogram metric type #39987

Open abraxas81 opened 1 week ago

abraxas81 commented 1 week ago

Hi I would like to report issue with metricbeat Statsd module.

When flushing timer and histogram metric types, count value just keep growing instead of being reset, they are reset only when there is some inactivity between flushes.

The problem occurs with timer and histogram metric types for count value.

If you compare behaviour with GitHub - statsd/statsd: Daemon for easy but powerful stats aggregation they are resetting count value for timer metric type.

Configuration

  1. Enable statsd metricbeat module
    #statsd.yml 
    -   module: statsd
    metricsets: [ "server" ]
    host: "localhost"
    port: "8125"
    enabled: true
    period: 10s
  2. Output to console
    #metricbeat.yml
    output.console:
    pretty: true
  3. Send some example metrics while true; do echo "processing_item:3000|h" > /dev/udp/127.0.0.1/8125 ; sleep 3s; done
  4. Example output
{
  "@timestamp": "2024-06-04T13:58:55.047Z",
  "@metadata": {
    "beat": "metricbeat",
    "type": "_doc",
    "version": "8.13.4"
  },
  "statsd": {
    "processing_item": {
      "median": 3000,
      "p75": 3000,
      "p95": 3000,
      "p99_9": 3000,
      "stddev": 0,
      "p99": 3000,
      "count": 4,
      "min": 3000,
      "max": 3000,
      "mean": 3000
    }
  },
}
{
  "@timestamp": "2024-06-04T13:59:05.047Z",
  "@metadata": {
    "beat": "metricbeat",
    "type": "_doc",
    "version": "8.13.4"
  },
  "statsd": {
    "processing_item": {
      "mean": 3000,
      "p95": 3000,
      "median": 3000,
      "p99": 3000,
      "count": 7, #expected 3
      "max": 3000,
      "p75": 3000,
      "p99_9": 3000,
      "min": 3000,
      "stddev": 0
    }
  },
}
{
  "@timestamp": "2024-06-04T13:59:15.046Z",
  "@metadata": {
    "beat": "metricbeat",
    "type": "_doc",
    "version": "8.13.4"
  },
  "statsd": {
    "processing_item": {
      "mean": 3000,
      "p75": 3000,
      "count": 10, #expected 3
      "stddev": 0,
      "p99_9": 3000,
      "median": 3000,
      "p95": 3000,
      "min": 3000,
      "max": 3000,
      "p99": 3000
    }
  }
}
  1. We got count 4, 7, 10 instead expected count 4, 3, 3