石墨 - 聚合时最后几个数据点为空

graphite - last few datapoints are null when aggregating

如果我获取前 1 小时的渲染(缓存已禁用),我将获取到当前时间的所有数据点。此处未聚合,显示每秒 1 次更新。例如,

http://graphite/render?target=local.metric.path&from=-1h&format=json&cacheTimeout=0

... [-2960.12, 1505975193], [-2960.12, 1505975194], [-2960.12, 1505975195], [-2960.12, 1505975196], [-2960.12, 1505975197], [-2960.12, 1505975198], [-2960.12, 1505975199], [-2960.12, 1505975200], [-2960.12, 1505975201], [null, 1505975202]]}]

太棒了。但是,如果我现在将渲染时间调高到之前的 2 小时,现在可以看到它在 5 秒时聚合数据,最后几个点都是 'null'.

... [-2775.75, 1505975390], [-2667.612, 1505975395], [-2595.52, 1505975400], [-2595.52, 1505975405], [-2595.52, 1505975410], [-2595.52, 1505975415], [-2595.52, 1505975420], [-2595.52, 1505975425], [-2595.52, 1505975430], [-2595.52, 1505975435], [null, 1505975440], [null, 1505975445], [null, 1505975450], [null, 1505975455], [null, 1505975460], [null, 1505975465], [null, 1505975470], [null, 1505975475], [null, 1505975480], [null, 1505975485], [null, 1505975490], [null, 1505975495], [null, 1505975500], [null, 1505975505], [null, 1505975510], [null, 1505975515], [null, 1505975520], [null, 1505975525], [null, 1505975530], [null, 1505975535], [null, 1505975540], [null, 1505975545], [null, 1505975550], [null, 1505975555], [null, 1505975560], [null, 1505975565], [null, 1505975570], [null, 1505975575]]}]

进一步挖掘,空点都是在最后一次将指标写入磁盘上的 whisper 文件之后的那些。

已尝试寻找常见原因..

耳语信息看起来像..

[root@graphite]# whisper-info mymetric.wsp
maxRetention: 157680000
xFilesFactor: 0.0
aggregationMethod: average
fileSize: 1176592

Archive 0
retention: 3600
secondsPerPoint: 1
points: 3600
size: 43200
offset: 112

Archive 1
retention: 43200
secondsPerPoint: 5
points: 8640
size: 103680
offset: 43312
...

任何想法表示赞赏。 谢谢,

更新:添加 carbon.conf aggregate/cache 设置..

[cache]
MAX_CACHE_SIZE = inf
CACHE_QUERY_INTERFACE = 0.0.0.0
CACHE_QUERY_PORT = 7002
LOG_CACHE_HITS = False
LOG_CACHE_QUEUE_SORTS = True
CACHE_WRITE_STRATEGY = sorted

[aggregator]
MAX_AGGREGATION_INTERVALS = 5

访问多个 Whisper“保留存档”的查询 will/may return NULL 值。

例如,假设 /opt/graphite/conf/storage-schemas.conf 表示:

[default]
pattern = .*
retentions = 60s:1d,10m:1y

并且您在查询最近 1 天时获得了值。查询最近 2 天 will/may 结果是最近 1 天的 NULL 值!

另请注意,更改保留配置时,应相应调整现有存档的大小:

(假设新配置为1m:400d 10m:3y,以减少意外访问多个“保留档案”的机会)

cd /opt/graphite/storage/whisper
# see the old size of the data store
du -skh
find ./ -type f -name '*.wsp' -exec whisper-resize.py --nobackup {} 1m:400d 10m:3y \;
# see the new size of the data store (Whisper preallocates what space it needs)
du -skh

编辑: 我还没有测试过,但是 NULL 问题是否真的会发生,可能与实际数据点的稀疏程度有关,而存储中的 xFilesFactor-aggregation.conf (doc) 改变可能也需要运行 whisper-resize.py--xFilesFactor=new_value 如果 new_value 为 0.0,则从单个查询访问多个“保留档案”应该没问题。

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.