__execute-count 值与 Metrics Reporting API v2 收集的值之间的差异

Differnces between __execute-count value and values gathered by the Metrics Reporting API v2

我有 运行 拓扑,我在 metric 报告 API v2 中使用了 Meter 类型。在执行方法中,我标记了这个指标。因此,只要调用 execute 方法,它就会标记一个事件。但是当我将这个值与 __execute-count 进行比较时,我发现了巨大的差异。有谁知道为什么会这样?

这些是我日志中同时收集的值:

9:v7 __execute-count {v0:v7=44500}
9:v7 tuple_inRate.count 664129

更新: 当我在 Meter 指标上使用 mark 方法时,与 Counter 指标相比,我会得到不同的结果。但是,我仍然不明白为什么计数器指标(元组计数器)的值与 __execute-count.

不同

如此 answer 中给出的,Storms 内部指标只是 根据实际数据流的百分比估计 。最初,它使用 5% 的传入元组来进行这些估计。这可能会导致极高或极低吞吐量的不准确性。

编辑:文档描述如下:

In general all of these tuple count metrics are randomly sub-sampled unless otherwise stated. This means that the counts you see both on the UI and from the built in metrics are not necessarily exact. In fact by default we sample only 5% of the events and estimate the total number of events from that. The sampling percentage is configurable per topology through the topology.stats.sample.rate config. Setting it to 1.0 will make the counts exact, but be aware that the more events we sample the slower your topology will run (as the metrics are counted in the same code path as tuples are processed). This is why we have a 5% sample rate as the default.

EDIT 2 在这个post中,有更多关于估计的信息:

The way it works is that if you choose a sampling rate of 0.05, it will pick a random element of the next 20 events in which to increase the count by 20. So if you have 20 tasks for that bolt, your stats could be off by +-380.

顺便说一下,execute_count 只是一个递增的数字,而你的 tuple_inRate.count 是一个比率,不是吗?