石墨总结数据点 [英] graphite summarize datapoints

查看:124
本文介绍了石墨总结数据点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用石墨来收集数据,我想检索某些特定对象的总数一段时间内发生的事件.说每周的登录次数.

I'm using graphite to collect data, and I'd like to retrieve the total count of certain events over a period of time. Say, number of logins per week.

但是,我只需要总数,而无需查看其随着时间的变化.

However, I just need the total number, and don't need to see how it evolves over time.

当我使用from=-1w&target=summarize(stats.events.login.success,"1w")&format=json之类的东西时,我仍然得到 两个 数据点,而不是一个.

When I use something like from=-1w&target=summarize(stats.events.login.success,"1w")&format=json then I still get two datapoints, and not one.

是否可以从summarize函数中获取单个数据点?或使用其他函数返回单个数据点值?

Is there a way to get a single datapoint from the summarize function? or use a different function to return a single datapoint value?

推荐答案

这里的问题是摘要默认情况下不与from字段对齐.

The problem here is that summarize doesn't align to the from field by default.

summarize(seriesList, intervalString, func='sum', alignToFrom=False)

如果愿意

from=-1w&target=summarize(stats.events.login.success,"1w","sum",true)&format=json

您应该只获得一个数据点.现在它正在执行的操作是根据您的from参数开始,将存储桶与不适合一周范围的日期对齐,因此最终有2个存储桶.摘自石墨文档:

you should get just one datapoint. What it's doing right now is aligning your buckets to dates that don't fit within the week range starting from your from parameter, so you end up with 2 buckets. From the graphite docs on summarize:

默认情况下,通过四舍五入到最接近的间隔来计算存储桶. 对于间隔小于一天的间隔,此方法效果很好.例如22:32 当间隔= 1小时时,它将在22:00-23:00进入存储桶.

By default, buckets are caculated by rounding to the nearest interval. This works well for intervals smaller than a day. For example, 22:32 will end up in the bucket 22:00-23:00 when the interval=1hour.

传递alignToFrom = true会创建从以下位置开始的存储桶 从时间.在这种情况下,22:32的时段取决于 时间.如果from = 6:30,则22:32的1小时时段为22:30-23:30.

Passing alignToFrom=true will instead create buckets starting at the from time. In this case, the bucket for 22:32 depends on the from time. If from=6:30 then the 1hour bucket for 22:32 is 22:30-23:30.

这篇关于石墨总结数据点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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