石墨价值的积累
每次用户连接到我的网站时,我都会发送一条消息。
使用这种格式:
"user_login 1 13xxxxxxx" (key value timestamp)
我的问题是 Graphite 每分钟给我一个只有一条值为“1”的线的图表。 我每分钟发送随机数量的消息(6 到 60 之间),但我认为 Graphite 限制为第一条(或最后一条?)消息,以显示值。
如何计算每分钟每条消息的总和?
I send one message each time a user connect to my site.
With this format:
"user_login 1 13xxxxxxx" (key value timestamp)
My problem is Graphite give me a graph with only a line with the value "1", each minute.
I send a random number of messages each minutes (between 6 and 60), but I think Graphite limits to the first (or last?) message, to display a value.
How to do to have an sum of each message, each minute ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您还可以尝试碳聚合服务,以便在收集指标时进行聚合,而不是在 Graphite UI 中进行聚合。请参阅http://graphite.readthedocs.org/en/ latest/config-carbon.html#aggregation-rules-conf 用于聚合规则配置。请注意,您需要将指标发送到在与普通 Carbon Collector 端口不同的端口中运行的 Carbon 聚合服务端口。
You could also try carbon aggregation service so that metrics are aggregated when they are collected instead of in the Graphite UI. See http://graphite.readthedocs.org/en/latest/config-carbon.html#aggregation-rules-conf for aggregation rule configuration. Note that you need to send the metrics to carbon aggregation service port that is running in different port than the normal carbon collector port.
您可能有兴趣在 Graphite 服务器上运行 statsd 或 statsite。该软件将汇总每个可配置时间段的所有统计数据,并将结果写入石墨。
查看 github.com/etsy/statsd(在 Node.js 中)和 github.com/kiip/statsite(Python 克隆)。 Etsy 的 statsd 包含一些有关如何使用它的代码示例。
You might be interested in running statsd or statsite on your graphite server. That software will aggregate all statistics per a configurable time period, and write the result out to graphite.
Take a look at github.com/etsy/statsd (in node.js) and github.com/kiip/statsite (python clone). Etsy's statsd contains a few code examples on how to use it.
如果您想求和超过一分钟,请使用 sumSeries target=sumSeries(graphite.counterName) 或汇总函数
use sumSeries target=sumSeries(graphite.counterName) or summarize function if you want to sum over more than one minute
Jari 是正确的,carbon-aggregator 是专门为此编写的。
确保在aggregation-rules.conf中使用sum函数,如下所示:
Jari is correct, carbon-aggregator was written specifically for this.
Make sure you use a sum function in aggregation-rules.conf, such as this:
http://code.hootsuite.com/accurate-counting-with-石墨-and-statsd/
http://obfuscurity.com/2012/04/Unhelpful-Graphite-Tip-1
http://graphite.readthedocs.org/en/latest/functions.html#graphite.render.functions.hitcount
http://code.hootsuite.com/accurate-counting-with-graphite-and-statsd/
http://obfuscurity.com/2012/04/Unhelpful-Graphite-Tip-1
http://graphite.readthedocs.org/en/latest/functions.html#graphite.render.functions.hitcount
这也可能是您的数据按指标聚合的方式,它默认为平均值,这可能不是您所期望的。另请参阅 使用 StatsD 跟踪指标(通过etsy) 和 Graphite,石墨图似乎没有绘制所有数据。
This may also be how your data is aggregated per metric, it defaults to averages which may not be what you expects. See also Tracking metrics using StatsD (via etsy) and Graphite, graphite graph doesn't seem to be graphing all the data.
在您的系列上使用累积函数。
Use the cumulative function on your series.
默认情况下,Graphite 仅存储以最小保留粒度发送的任何传入指标的最后值(而不平均值)。如果您想要聚合,常见的解决方案是使用 statsd。
但是,您也可以使用碳聚合器。只需确保您将指标发送到聚合器线路端口,然后使用如下规则更新aggregation-rules.conf:
注意:这假设您的最短保留期仍然是 10 秒(默认值),您可以通过查看来确认storage-schemas.conf
有关详细说明,请参阅:当石墨的 Carbon 聚合器可以做到这一点时,为什么要使用 statsd同样的工作?
by default, graphite only stores the last value sent for any incoming metric in the minimum retention granularity (not the mean value). if you want aggregates, the common solution is to use statsd.
however, you can also use carbon-aggregator. just be sure you are sending your metrics to the aggregator line port, then update aggregation-rules.conf with a rule like this:
note: this assumes your minimum retention period is still 10 seconds (the default) you can confirm that by looking in storage-schemas.conf
for a longer explanation, see: Why use statsd when graphite's Carbon aggregator can do the same job?