how to get least possible count on graphite graph

情到浓时终转凉″ 提交于 2019-12-01 12:19:41

Long story short: You cannot flush Statsd at an interval lower than 1 second when using Graphite as the backend.

Because you've specified a flushInterval of 10 ms, StatsD will flush the aggregated data-point every 10 milliseconds of which Graphite will drop 99 out of 100 (all but one of the 10ms flushes).

First, setting it this low defeats some of the purpose of Statsd in that it is intended to act as an aggregator that can reduce load on graphite. Second, setting it to anything lower than 1 second will result in lost metric data. This is because the finest precision that you can store in Graphite is 1 second. So you'll send 100 data points to graphite per second and Graphite will only store 1 of them. You'd have to be pretty lucky to see any data (as it will take the last metric (overwriting the others) for the interval.

You must match the flush interval in StatsD to the finest precision schema setting in Graphite (in the storage-schema configuration). The lowest you can go is one second, but 10 seconds is recommended so that StatsD can do some significant aggregation work on your behalf.

I'd recommend you change the finest (first) precision to 10 seconds, i.e. 10s:6h and 10s:7d for the retentions (and the Statsd flushInterval to 10000 ms) so that Statsd and Graphite line up nicely.

Next, make the above change and then resize the whisper files to ensure the settings have taken. Perhaps you changed the graphite schema or aggregation settings after metrics were stored (in whisper = graphite's storage) and you still need to either delete the .wsp files for the metric (graphite will recreate them) or run whisper-resize.py. The whisper files are in /graphite/storage/whisper/.

Finally, validate the settings. You can verify the settings against some whisper data by running whisper-info.py on a .wsp file. Find the .wsp file for one of your metrics in /graphite/storage/whisper/ Run: whisper-info.py my_metric_data.wsp. whisper-info.py output should tell you more about how the storage settings are working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!