Graphite/Carbon 如何获得每秒指标 [英] Graphite/Carbon how to get per-second metrics

查看:25
本文介绍了Graphite/Carbon 如何获得每秒指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经

根据这篇SO帖子我已将保留策略设置为每秒抓取数据.我也设置了

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

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

分别在设置拓扑和螺栓本身的类中.据我了解,这应该会导致每秒报告一次指标.我在这里缺少什么?如何让指标每秒报告一次?

提前 t/y,祝大家节日快乐!

更新 1

这是我的 storage-schemas.conf 文件:

root@cdd13a16103a:/etc/carbon# cat storage-schemas.conf# Whisper 文件的模式定义.条目按顺序扫描,# 并且第一场比赛获胜.每 60 秒扫描一次此文件的更改.##  [姓名]# 模式 = 正则表达式# 保留 = timePerPoint:timeToStore, timePerPoint:timeToStore, ...# Carbon 的内部指标.此条目应与中指定的内容相匹配# CARBON_METRIC_PREFIX 和 CARBON_METRIC_INTERVAL 设置[碳]模式 = ^碳\.保留 = 1s:6h,1min:7d,10min:5y[default_1min_for_1day]模式 = .*保留 = 1s:6h,1min:7d,10min:5y[测试]模式 = ^ 测试.保留 = 1s:6h,1min:7d,10min:5y[风暴]模式 = ^风暴.保留 = 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");

解决方案

为了应用 storage-schemas.conf 中的更改,您必须:

  • 重启碳
  • 删除旧的 *.wsp 或使用 whisper-resize.py 应用方案
  • 重启 carbon-cache
  • 确保 webapp 的 local_settings.py 中的 DEFAULT_CACHE_DURATION 设置为 1
  • 确保 nginx/apache2/uwsgi 缓存设置正确,如果有的话

还有更多石墨随附的whisper-* 工具.下一个你可能感兴趣的是 whisper-info.py

 bash$whisper-info.py/graphite/whisper/prod/some/metric.wsp最大保留:1296000xFilesFactor:0.5聚合方法:平均文件大小:142600存档 0保留:691200>>秒每点:1积分:11520尺寸:138240偏移量:40存档 1保留:1296000秒每点:3600积分:360尺寸:4320偏移量:138280

I've dockerized graphite and am working with this library to get metrics from an Apache Storm topology. I'm getting metrics data, but no matter what I do I can only get data per minute where I really need the points to be per second.

As per this SO post I've set the retention policy to grab data every second. I've also set

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

and

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

in the class that's setting up the topology and the bolt itself, respectively. To my understanding this should cause metrics to be reported every second. What am I missing here? How can I get metrics to be reported every second?

t/y in advance and happy holidays all!

update 1

here is my storage-schemas.conf file:

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

Here is my config setup:

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");

解决方案

In order to apply changes in storage-schemas.conf you have to:

  • restart carbons
  • delete old *.wsp or use whisper-resize.py to apply scheme
  • restart carbon-cache
  • make sure that DEFAULT_CACHE_DURATION in webapp's local_settings.py is set to 1
  • make sure nginx/apache2/uwsgi cache is set up correctly as well, if any

There is more whisper-* tools shipped with graphite. The next you may be interested is 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

这篇关于Graphite/Carbon 如何获得每秒指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆