石墨价值的积累

发布于 2024-11-29 23:37:09 字数 252 浏览 2 评论 0原文

每次用户连接到我的网站时,我都会发送一条消息。

使用这种格式:

"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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

左秋 2024-12-06 23:37:09

您还可以尝试碳聚合服务,以便在收集指标时进行聚合,而不是在 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.

沉溺在你眼里的海 2024-12-06 23:37:09

您可能有兴趣在 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.

吻安 2024-12-06 23:37:09

如果您想求和超过一分钟,请使用 sumSeries target=sumSeries(graphite.counterName) 或汇总函数

use sumSeries target=sumSeries(graphite.counterName) or summarize function if you want to sum over more than one minute

悲喜皆因你 2024-12-06 23:37:09

Jari 是正确的,carbon-aggregator 是专门为此编写的。

确保在aggregation-rules.conf中使用sum函数,如下所示:

bpu.<cluster>.<account>.<metric>_sum (1) = sum bpu.<cluster>.<account>.<metric>_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:

bpu.<cluster>.<account>.<metric>_sum (1) = sum bpu.<cluster>.<account>.<metric>_sum
九歌凝 2024-12-06 23:37:09

这也可能是您的数据按指标聚合的方式,它默认为平均值,这可能不是您所期望的。另请参阅 使用 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.

人│生佛魔见 2024-12-06 23:37:09

在您的系列上使用累积函数

默认情况下,绘制图形时,图形的宽度为
像素小于要绘制图表的数据点的数量,
Graphite 对每个像素的值进行平均。累积()函数
将合并函数更改为平均值求和。

Use the cumulative function on your series.

By default, when a graph is drawn, and the width of the graph in
pixels is smaller than the number of datapoints to be graphed,
Graphite averages the value at each pixel. The cumulative() function
changes the consolidation function to sum from average.

霞映澄塘 2024-12-06 23:37:09

默认情况下,Graphite 仅存储以最小保留粒度发送的任何传入指标的最后值(而不平均值)。如果您想要聚合,常见的解决方案是使用 statsd

但是,您也可以使用碳聚合器。只需确保您将指标发送到聚合器线路端口,然后使用如下规则更新aggregation-rules.conf:

user_login (10) = sum user_login$

注意:这假设您的最短保留期仍然是 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:

user_login (10) = sum user_login$

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文