graphite/carbon如何获得每秒的指标

c6ubokkw  于 2021-06-21  发布在  Storm
关注(0)|答案(1)|浏览(446)

我已经对接了graphite,正在使用这个库从apachestorm拓扑中获取度量。我正在获取度量数据,但无论我做什么,我只能获取每分钟的数据,而我真正需要的是每秒的点数。

根据这篇文章,我将保留策略设置为每秒获取数据。我还设置了

conf.put("topology.builtin.metrics.bucket.size.secs", 1);

以及

void initMetrics(TopologyContext context) {
    messageCountMetric = new CountMetric();
    context.registerMetric("digest_count", messageCountMetric, 1);
}

在分别设置拓扑和螺栓本身的类中。据我所知,这应该导致每秒钟报告一次指标。我错过了什么?如何让指标每秒都报告一次?
预祝您节日快乐!
更新1
这是我的storage-schemas.conf文件:

root@cdd13a16103a:/etc/carbon# cat storage-schemas.conf 

# Schema definitions for Whisper files. Entries are scanned in order,

# and first match wins. This file is scanned for changes every 60 seconds.

# 

# [name]

# pattern = regex

# retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ...

# Carbon's internal metrics. This entry should match what is specified in

# CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings

[carbon]
pattern = ^carbon\.
retentions = 1s:6h,1min:7d,10min:5y

[default_1min_for_1day]
pattern = .*
retentions = 1s:6h,1min:7d,10min:5y

[test]
pattern = ^test.
retentions = 1s:6h,1min:7d,10min:5y

[storm]
pattern = ^storm.
retentions = 1s:6h,1min:7d,10min:5y

这是我的配置设置:

Config conf = new Config();
conf.setDebug(false);
conf.put("topology.builtin.metrics.bucket.size.secs", 1);
conf.registerMetricsConsumer(GraphiteMetricsConsumer.class, 4);
conf.put("metrics.reporter.name", "com.verisign.storm.metrics.reporters.graphite.GraphiteReporter");
conf.put("metrics.graphite.host", "127.0.0.1");
conf.put("metrics.graphite.port", "2003");
conf.put("metrics.graphite.prefix", "storm.test");
tzxcd3kk

tzxcd3kk1#

为了应用 storage-schemas.conf 你必须:
重启碳棒
删除旧的*.wsp或使用 whisper-resize.py 应用方案
重新启动碳缓存
确保 DEFAULT_CACHE_DURATION 在webapp的本地设置中,py设置为1
确保nginx/apache2/uwsgi缓存设置正确(如果有)
还有更多的耳语-*石墨工具。下一个你可能感兴趣的是 whisper-info.py ```
bash$ whisper-info.py /graphite/whisper/prod/some/metric.wsp
maxRetention: 1296000
xFilesFactor: 0.5
aggregationMethod: average
fileSize: 142600

Archive 0
retention: 691200

secondsPerPoint: 1
points: 11520
size: 138240
offset: 40

Archive 1
retention: 1296000
secondsPerPoint: 3600
points: 360
size: 4320
offset: 138280

相关问题