3 java apache-camel spring-boot prometheus
我正在尝试转发/添加 Actuator Camel 指标 /actuator/camelroutes(交换/交易数量等路由指标)到 Prometheus Actuator 端点。我有没有办法配置 Camel 以将这些指标添加到 PrometheusMeterRegistry?
我试过添加:
camel.component.metrics.metric-registry=io.micrometer.prometheus.PrometheusMeterRegistry
Run Code Online (Sandbox Code Playgroud)
在我application.properties根据这里的文档:https : //camel.apache.org/components/latest/metrics-component.html
但是仍然没有显示与 Apache Camel 相关的任何内容 actuator/prometheus
以下是我在Spring Boot 2.1.9和Apache Camel 2.24.2 中使用的依赖项:
camel.component.metrics.metric-registry=io.micrometer.prometheus.PrometheusMeterRegistry
Run Code Online (Sandbox Code Playgroud)
小智 5
获得了在/actuator/prometheus端点中工作的 Camel Routes 指标。
使用@claus-ibsen 的评论所述的camel-micrometer-starter依赖项。
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-metrics-starter</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
在您的属性文件中设置以下内容:
camel.component.metrics.metric-registry=prometheusMeterRegistry
Run Code Online (Sandbox Code Playgroud)
然后添加设置 Camel Context 以使用 MicrometerRouterPolicyFactory 和 MicrometerMessageHistoryFactory。下面看到的代码位于 Configuration 类中:
camel.component.metrics.metric-registry=prometheusMeterRegistry
Run Code Online (Sandbox Code Playgroud)
您需要在路由中触发交换以使指标出现在/actuator/prometheus.
以下是 Prometheus 可用的指标:
您可以使用 Prometheus 的 JMX 导出器 jar 从 Camel 的 JMX 获取更详细的指标。我想避免这种方法,因为这意味着对于每个 Camel Spring Boot 应用程序,我都会使用 2 个端口;1 表示 JMX 指标,1 表示执行器指标。
| 归档时间: |
|
| 查看次数: |
4092 次 |
| 最近记录: |