Graphite/Carbon 如何获取每秒指标

Graphite/Carbon how to get per-second metrics

dockerized graphite and am working with this library 从 Apache Storm 拓扑中获取指标。我正在获取指标数据,但无论我做什么,我都只能在我真正需要每秒获取点数的地方获取每分钟的数据。

根据this SO post,我将保留策略设置为每秒抓取数据。我还设置了

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

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

在 class 中,分别设置拓扑和螺栓本身。据我了解,这应该会导致每秒报告一次指标。我在这里错过了什么?我怎样才能让指标每秒报告一次?

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

更新 1

这是我的存储-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");

要在 storage-schemas.conf 中应用更改,您必须:

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

还有更多whisper-* tools shipped with graphite。下一个你可能感兴趣的是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