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

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

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

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

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

以及

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

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

  1. root@cdd13a16103a:/etc/carbon# cat storage-schemas.conf
  2. # Schema definitions for Whisper files. Entries are scanned in order,
  3. # and first match wins. This file is scanned for changes every 60 seconds.
  4. #
  5. # [name]
  6. # pattern = regex
  7. # retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ...
  8. # Carbon's internal metrics. This entry should match what is specified in
  9. # CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings
  10. [carbon]
  11. pattern = ^carbon\.
  12. retentions = 1s:6h,1min:7d,10min:5y
  13. [default_1min_for_1day]
  14. pattern = .*
  15. retentions = 1s:6h,1min:7d,10min:5y
  16. [test]
  17. pattern = ^test.
  18. retentions = 1s:6h,1min:7d,10min:5y
  19. [storm]
  20. pattern = ^storm.
  21. retentions = 1s:6h,1min:7d,10min:5y

这是我的配置设置:

  1. Config conf = new Config();
  2. conf.setDebug(false);
  3. conf.put("topology.builtin.metrics.bucket.size.secs", 1);
  4. conf.registerMetricsConsumer(GraphiteMetricsConsumer.class, 4);
  5. conf.put("metrics.reporter.name", "com.verisign.storm.metrics.reporters.graphite.GraphiteReporter");
  6. conf.put("metrics.graphite.host", "127.0.0.1");
  7. conf.put("metrics.graphite.port", "2003");
  8. 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

  1. Archive 0
  2. retention: 691200

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

  1. Archive 1
  2. retention: 1296000
  3. secondsPerPoint: 3600
  4. points: 360
  5. size: 4320
  6. offset: 138280
展开查看全部

相关问题