require 'statsd'
statsd = Statsd.new('localhost', 8125).tap{|sd| sd.namespace = 'account'}
1.times do
statsd.increment 'hitcount4'
end
sleep 5
5.times do
statsd.increment 'hitcount4'
end
sleep 10
10.times do
statsd.increment 'hitcount4'
end
Run Code Online (Sandbox Code Playgroud)
我正在使用红宝石宝石 statsd-ruby
我运行上面的脚本它成功执行,图形出现,但我只能看到x轴上的一条线而没有(没有y轴的值),如何获取上述脚本的图形?
我想记录每个增量调用.
/opt/graphite/statsd/local.js的内容
{
graphitePort: 2003
, graphiteHost: "127.0.0.1"
, port: 8125
, backends: [ "./backends/graphite", "./backends/repeater", "./backends/console" ]
, repeater: [ { host: '10.1.2.15', port: 8125 } ]
, graphite: { legacyNamespace: false, globalPrefix: "rtpg.testing_server_2" }
, flushInterval: 10
}
Run Code Online (Sandbox Code Playgroud)
/opt/graphite/conf/storage-schemas.conf的内容
[carbon]
pattern = ^carbon\.
retentions = 60:90d
[stats] …Run Code Online (Sandbox Code Playgroud) ./statsd-client.sh 'development.com.alpha.operation.testing.rate:1|c'然后我尝试查询过去24小时的摘要:
http://example.com/render?format=json&target=summarize(stats.development.com.alpha.operation.testing.rate,"24hours","sum",true)&from = -24hours&tz = UTC
我得到1个数据点如下:
"datapoints": [[0.0, 1386277560]]}]
Run Code Online (Sandbox Code Playgroud)
为什么我得到0.0?甚至Graphite Composer也不会显示任何内容
当我执行10次操作时,我期待值为"10".我做错了什么?
存储schemas.conf
[carbon]
pattern = ^carbon\.
retentions = 60:90d
[default_1min_for_1day]
pattern = .*
retentions = 60s:1d
Run Code Online (Sandbox Code Playgroud)
请帮我理解这个问题.
编辑:
根据下面的答案,我更改了存储聚合,并在metric_file.wsp上运行whisper-info后得到以下响应.但我仍然在数据点中获得"0.0"作为值,而Graphite浏览器不显示任何内容.
maxRetention: 86400
xFilesFactor: 0.0
aggregationMethod: sum
fileSize: 17308
Archive 0
retention: 86400
secondsPerPoint: 60
points: 1440
size: 17280
offset: 28
Run Code Online (Sandbox Code Playgroud)
我还看了另一个答案中建议的stats_counts树,但它是一样的.
我的设置有什么问题.我正在使用默认设置,除了存储聚合中下面的答案所建议的更改