石墨,如果选择较宽的时间范围,数据点将消失 [英] Graphite, datapoints disappear if I choose a wider time range

查看:140
本文介绍了石墨,如果选择较宽的时间范围,数据点将消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我要求提供这些数据:

https://graphite.it.daliaresearch.com/render?from=-2hours&until=now&target=my.key&format=json

除其他数据点外,我得到了这一点:

[
  2867588,
  1398790800
]

如果我要求提供这些数据:

https://graphite.it.daliaresearch.com/render?from=-10hours&until=now&target=my.key&format=json

数据点看起来像这样:

[
  null,
  1398790800
]

当我选择更宽的时间范围时,为什么此数据点被空化了?

更新

我看到,对于所选的小于7小时的日期范围,数据点的分辨率每10秒,并且当所选的日期范围为7小时或分辨率越大,分辨率就会每1分钟 ..并继续执行此操作,因为选择的日期范围将<10> 每10分钟增加一个数据点,依此类推.

因此,当数据点的分辨率为每10秒有数据时,数据分辨率为每1分钟或更长时间时,则数据点的值不为:/

我每1小时发送一个数据点,也许与分辨率配置有冲突,我每小时仅发送一个数据点

解决方案

这里发生了几件事,但是基本上问题是您配置了错误的石墨(或者至少以使其工作的方式配置了石墨)你没想到!)

具体来说,您应该在storage-aggregation.conf文件中设置xFilesFactor = 0.0.由于您是新手,所以您可能只想要这个(我的位置在/opt/graphite/conf/storage-aggregation.conf中):

[default]
pattern = .*
xFilesFactor = 0.0
aggregationMethod = average

石墨文档像这样描述xFilesFactor:

xFilesFactor应该是介于0到1之间的浮点数,并指定前一个保留级别的插槽中有多少分数必须具有非空值才能聚合为非空值.默认值为0.5.

但是等等!这不会更改现有统计信息!在创建度量标准时,每个度量标准都会设置一次这些聚合设置.既然您是新手,那么简单的方法就是转到耳语目录并删除先前的数据并重新开始:

cd /opt/graphite/storage/whisper/my/
rm key.wsp

根耳语目录可能因平台等而异.删除数据文件后,石墨应在下一个度量标准写入时自动重新创建它们,并且它们应获得更新的设置(不要忘记在更改存储后重启碳缓存) -聚合设置).

或者,如果您需要保留旧数据,则需要使用--xFilesFactor = 0.0来对私语(.wsp)数据文件运行whisper-resize.py,还可能需要来自storage-schemas.conf的所有保留设置(也可以通过whisper-info.py查看)

最后,我要补充一句,您在第一个查询中获得非空数据的原因,而在第二个查询中获得非空数据的原因是,石墨将尝试根据时间来选择最佳的保留期限,以便为您的请求提供服务您请求的窗口.对于较小的窗口,石墨决定使用最高精度的数据(即非汇总数据)来满足您的要求,因此您会看到原始指标.对于更长的时间窗口,石墨发现无法在整个窗口中使用高精度的非汇总数据-这些时间段在storage-schemas.conf中配置-因此它会跳至下一个精度最高的数据集可用(即第一聚合层),并且仅返回聚合数据.由于您的聚合配置正在写入空数据,因此您将看到空指标!因此,请修复聚合,然后应修复空数据问题.但是请记住,石墨永远不会在单个请求/响应中组合聚合层,因此,只要您更改的只是/到参数,当您看到同一查询的结果之间存在差异时,问题几乎总是归因于聚合配置. /p>

If I ask for this data:

https://graphite.it.daliaresearch.com/render?from=-2hours&until=now&target=my.key&format=json

I get, among other datapoints, this one:

[
  2867588,
  1398790800
]

If I ask for this data:

https://graphite.it.daliaresearch.com/render?from=-10hours&until=now&target=my.key&format=json

The datapoint looks like this:

[
  null,
  1398790800
]

Why this datapoint is being nullified when I choose a wider time range?

Update

I'm seeing that for a chosen date range smaller than 7 hours the resolution of the datapoints are every 10 seconds and when the date range chosen is 7 hours or bigger the the resolution goes to one datapoint every 1 minute.. and continue this diretion as the date range chosen is getting bigger to one datapoint every 10 minutes and so.

So when the resolution of the datapoints is every 10 seconds the data is there, when the resolution is every 1 minute or more, then the datapoint has not the value :/

I'm sending a data point every 1 hour, maybe it is a conflict with the resolutions configuration and me sending only one datapoint per hour

解决方案

There are several things happening here, but basically the problem is that you have misconfigured graphite (or at least, configured it in a way that makes it do things that you aren't expecting!)

Specifically, you should set xFilesFactor = 0.0 in your storage-aggregation.conf file. Since you are new at this, you probably just want this (mine is in /opt/graphite/conf/storage-aggregation.conf):

[default]
pattern = .*
xFilesFactor = 0.0
aggregationMethod = average

The graphite docs describe xFilesFactor like this:

xFilesFactor should be a floating point number between 0 and 1, and specifies what fraction of the previous retention level’s slots must have non-null values in order to aggregate to a non-null value. The default is 0.5.

But wait! This wont change existing statistics! These aggregation settings are set once per metric at the time the metric is created. Since you are new at this, the easy way out is to just go to your whisper directory and delete the prior data and start over:

cd /opt/graphite/storage/whisper/my/
rm key.wsp

your root whisper directory may be different depending on platform, etc. After removing the data files graphite should recreate them automatically upon the next metric write and they should get your updated settings (dont forget to restart carbon-cache after changing your storage-aggregation settings).

Alternatively, if you need to keep your old data you will need to run whisper-resize.py against your whisper (.wsp) data files with --xFilesFactor=0.0 and also likely all of your retention settings from storage-schemas.conf (also viewable with whisper-info.py)

Finally, I should add that the reason you get non-null data in your first query, but null data in your second is because graphite will try to pick the best available retention period from which to serve your request based on the time window you requested. For the smaller window, graphite is deciding that it can serve your request using the highest precision data (i.e., non aggregated) and so you are seeing your raw metrics. For the longer time window, graphite is finding that the high precision, non-aggregated data is not available for the entire window -- these periods are configured in storage-schemas.conf -- so it skips to the next highest-precision data set available (i.e. first aggregation tier) and returns only aggregated data. Because your aggregation config is writing null data, you are therefore seeing null metrics! So fix the aggregation, and you should fix the null data problem. But remember that graphite never combines aggregation tiers in a single request/response, so anytime you see differences between results from the same query when all you are changing is the from / to params, the problem is pretty much always due to aggregation configs.

这篇关于石墨,如果选择较宽的时间范围,数据点将消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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