关于如何构建Grafana仪表板的小问题;有界弹性;vs";平行的";请
目前,我使用了一个SpringWebflux应用程序,为Reactor Core提供了开箱即用的非常有用的指标。
executor_pool_size_threads
executor_pool_core_threads
executor_pool_max_threads
etc
反应堆团队甚至提供了默认的仪表板,这样我们就可以看到状态:
https://github.com/reactor/reactor-monitoring-demo
不幸的是,当前的仪表盘混合了";有界弹性;以及";"平行";,我正在尝试构建相同的仪表板,但使用";有界弹性;以及";平行的";分离。
我试过了:
sum(executor_pool_size_threads{_ws_="my_workspace"}) by (reactor_scheduler_id, boundedElastic)
但到目前为止运气不佳。请问正确的做法是什么?谢谢
在演示项目中,度量存储在Prometheus中,并使用PromQL进行查询。每个度量可以有几个标签,每个标签可以有几个值。度量可以通过标签和值来选择,例如my_metric{first_label="first_value", second_label="another_value"}
选择my_metric
,其中两个标签都匹配相应的值。
因此,在您的示例中,度量executor_pool_size_threads
具有标签reactor_scheduler_id
。但是,这些值包含调度程序名称之外的更多信息。在我的计算机上(由于默认池大小(,值为:parallel(8,"parallel")
和boundedElastic("boundedElastic",maxThreads=80,maxTaskQueuedPerThread=100000,ttl=60s)
。因此,regex match在这里对于使用=~
运算符匹配值非常有用。
PromQL查询仅适用于parallel
:
sum (executor_pool_size_threads{reactor_scheduler_id=~"parallel.*"}) by (reactor_scheduler_id)
PromQL查询仅适用于boundedElastic
:
sum (executor_pool_size_threads{reactor_scheduler_id=~"boundedElastic.*"}) by (reactor_scheduler_id)