AppMetrics/Grafana-确定指标类型的问题
让我们假设有可以将交易状态更改为以下一个流程:start
,inproc1
,inproc2
,成功
,<代码>失败。每个交易都可以通过不同阶段过渡,例如开始 - &gt; inproc1-&gt;失败
。
现在,我想构建一个仪表板,显示特定时间间隔的给定状态中的交易量,例如Interval_1:[开始:20,失败:15,inproc1:5]
。
我遇到麻烦,可以识别与AppMetrics/Grafana一起使用的正确度量类型,以便我可以做到这一点。 Meters
将标记每个过渡(因此,对于我的示例,我将对每个新状态更改进行三个事件,例如_--&gt;
等)。因此,如果我想将每个交易状态标签分组,则该标签将无法使用,因为我的来源中有三个条目(我只想要最后一个,实际状态)。类似的问题可能是counters
(仅递增值),对于仪表
,没有选项可以传递字符串值(无论如何这可能没有意义)。
因此,理想情况下,我想在过渡发生时将一个值替换为新值(不仅增加计数器),因此我可以根据给定的时间戳显示它。我觉得我缺少一些东西:)
编辑: 请查看以下示例数据:
<table>
<tr>
<th>Value</th>
<th>State</th>
<th>Id</th>
</tr>
<tr>
<td>1</td>
<td>Started</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>InProc1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>InProc2</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>Finished</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>Started</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>InProc1</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>Failed</td>
<td>2</td>
</tr>
</table>
和查询: 从“源”中选择“ last(“ value”),count(“ value”),其中$ timeFilter组按时间($ __间隔),“状态”,“ ID”填充(null)
Let's assume there is flow which can change a status of a transaction to one of the following: Started
, InProc1
, InProc2
,Succeeded
, Failed
. Every transaction can transition through different stages, e.g. Started -> InProc1 -> Failed
.
Now, I'd like to build a dashboard showing the amount of transactions in a given status for a particular time interval, e.g. interval_1: [Started:20, Failed:15, InProc1:5]
.
I'm having troubles identifying the correct metric type to use with AppMetrics/Grafana so I could do that. Meters
would mark every transition (so for my examples I'd have three events for every new status change like _-> Started
, Started -> InProc1
, etc.). Thus, if I want to group per transaction status tag, this won't work because I'd have three entries in my source (I just want the last one, the actual state). Similar problem would be with Counters
(only incrementing the value) and for Gauges
there is no option to pass a string value (which probably doesn't make sense anyway).
So, ideally, I'd like to have a possibility to replace a value to a new one when the transition happens (not just increment the counter), so I could display it per given timestamp. I feel like I'm missing something :)
EDIT:
Please take a look at the below example data:
<table>
<tr>
<th>Value</th>
<th>State</th>
<th>Id</th>
</tr>
<tr>
<td>1</td>
<td>Started</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>InProc1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>InProc2</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>Finished</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>Started</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>InProc1</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>Failed</td>
<td>2</td>
</tr>
</table>
And the query:SELECT last("value"), count("value") FROM "source" WHERE $timeFilter GROUP BY time($__interval), "state", "id" fill(null)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从influxdb的角度来看(您需要将其“转换”到“ Appmetrics”框架的角度):
状态
将是具有值启动的标签使用重复数据删除) +您需要字段,因此生成一些(例如
value
并保存始终值1)查询:通常,使用last()选择器选择最后值,然后用
状态标签(和/或时间)
问题:未指定influxdb以进行更新,因此,如果您确实需要“替换的可能性”,那么InfluxDB不是一个不错的选择(InfluxDB解决方案将非常有用)。关系数据库将是一个更好的选择。
From the InfluxDB perspective (you need to "translate" it to the "AppMetrics" framework perspective):
state
will be a tag with valuesStarted, InProc1, InProc2,Succeeded, Failed
, you need alsotransactionid
tag (otherwise you may have a problem with deduplication) + you need field, so generate some (e.g.value
and save always value 1)Query: generally, use LAST() selector to select last values and then COUNT aggregation function with GROUP BY
state
tag (and/or time)Problem: InfluxDB is not designated for updates, so if you really need "possibility to replace", then InfluxDB is not a good choice (InfluxDB solution will be very hackish). Relational database will be a better option.