lukevenediger / statsd.net

A high-performance stats collection service that feeds into Graphite and aimed at small- to large-scale windows environments.
MIT License
122 stars 25 forks source link

Send metrics and meet Bad Message #46

Open keyboardfann opened 6 years ago

keyboardfann commented 6 years ago

Hi, When I send 2000 metrics to statsd.net TCP port, and I see there are some metrics missing and there are errors in the log. Does anyone meets the problem or has the suggestion to resolve it? I also do the same test to UDP port and no metrics loss and don't see the error.

Error log in stats-net.log

2018-01-26 10:02:15 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:15 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:16 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:16 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:18 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:18 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:19 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:19 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:21 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:21 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:22 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:22 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:24 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:24 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:25 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:25 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:27 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:27 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:28 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:28 DEBUG - Attempting to send 100 lines to tb_Metrics.
2018-01-26 10:02:30 DEBUG - Wrote 100 lines to tb_Metrics.
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tcp443.te
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tc
2018-01-26 10:02:42 INFO  - Bad message: Malformed message.
fanntest.tcp443.test:1
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fann
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
|c
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tcp443
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
f
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tcp443.tes
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tcp
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fannt
2018-01-26 10:02:42 INFO  - Bad message: Malformed message.
fanntest.tcp443.test:1|
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
c
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tcp443.
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fa
2018-01-26 10:02:42 INFO  - Bad message: Name cannot be empty.
:1|c
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tcp443.test
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tcp443.
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fanntest.tcp443.t
2018-01-26 10:02:42 INFO  - Bad message: Couldn't parse message: Index was outside the bounds of the array.
fan

statsdnet.config

<?xml version="1.0" encoding="utf-8" ?>
<statsdnet name="TNG-DMZ-2">
    <listeners>
    <tcp port="12222" />
        <tcp port="443" />
        <udp port="80" />
        <http port="80" allowCors="*" />
        <udp port="12000" />
    </listeners> 
    <aggregation flushInterval="1m">
        <gauges namespace="stats.gauges" removeZeroGauges="true" />
        <counters namespace="stats_counts" />
        <sets namespace="stats.sets" />
        <timers namespace="stats.timers" calculateSumSquares="false">
            <percentile name="p90-5min" threshold="90" flushInterval="5m" />
            <percentile name="p90-1hour" threshold="90" flushInterval="1h" />
            <percentile name="p50-1hour" threshold="50" flushInterval="1h" />
        </timers>
    </aggregation>
    <backends>
        <console />
        <graphite host="x.x.x.x" port="2003" />
        <sqlserver connectionString="server=x.x.x.x;database=x;uid=x;password=x"
                   writeBatchSize="100" />
    </backends>
</statsdnet>

Reproduce Step(python code):

import statsd,time
c = statsd.TCPStatsClient('x.x.x.x', 443)

for i in range(2000):
  print i
  c.incr('fanntest.tcp443.test')
  time.sleep(0.01)