Graphite / Carbon如何获得每秒指标

时间:2015-12-24 20:42:50

标签: java apache-storm metrics graphite

dockerized graphite正在与this library合作,以获取Apache Storm拓扑中的指标。我正在获取指标数据,但无论我做什么,我只能每分钟获得数据,而我真正需要每秒点数。

enter image description here

根据this SO post,我将保留政策设置为每秒抓取一次数据。我也设置了

MediaStore.EXTRA_OUTPUT

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

分别在设置拓扑和螺栓本身的类中。根据我的理解,这应该导致每秒报告指标。我在这里错过了什么?如何获得每秒报告的指标?

提前和节日快乐!

更新1

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

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

这是我的配置设置:

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

1 个答案:

答案 0 :(得分:4)

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

  • 重新启动碳素
  • 删除旧* .wsp或使用whisper-resize.py应用方案
  • 重启碳缓存
  • 确保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