当前位置: 首页 > 知识库问答 >
问题:

向普罗米修斯发送阿帕奇骆驼执行器指标

夹谷沛
2023-03-14

我正在尝试将/Actuator/camelroutes中的Actuator Camel度量(路由度量,如交换/事务数)转发/添加到Prometheus Actuatorendpoint。我有没有办法配置Camel来将这些指标添加到PrometheusMeterRegistry?

我试着补充:

camel.component.metrics.metric-registry=io.micrometer.prometheus.PrometheusMeterRegistry

在我的application.properties中,根据以下文档:https://camel.apache.org/components/latest/metrics-component.html

下面是我在Spring Boot 2.1.9和Apache Camel 2.24.2中使用的依赖关系:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
        <groupId>org.apache.camel</groupId>
            <artifactId>camel-metrics-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>

共有1个答案

程城
2023-03-14

/Actuator/Prometheusendpoint中获得了工作的骆驼路由度量。

使用camel-commeter-starter依赖关系,正如@Claus-Ibsen的评论所述。

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-metrics-starter</artifactId>
        </dependency>

在属性文件中设置以下内容:

camel.component.metrics.metric-registry=prometheusMeterRegistry
@Configuration
public class AppConfig {

    @Bean
    public CamelContextConfiguration camelContextConfiguration() {

        return new CamelContextConfiguration() {
            @Override
            public void beforeApplicationStart(CamelContext camelContext) {
                camelContext.addRoutePolicyFactory(new MicrometerRoutePolicyFactory());
                camelContext.setMessageHistoryFactory(new MicrometerMessageHistoryFactory());
            }

            @Override
            public void afterApplicationStart(CamelContext camelContext) {

            }
        };
    }

}

以下是普罗米修斯可用的度量标准:

  1. CamelMessageHistory_seconds_count
  2. CamelMessageHistory_Seconds_max
  3. camelroutepolicy_seconds_max
  4. camelroutepolicy_seconds_count
  5. camelroutepolicy_seconds_sum

您可以使用Prometheus的JMX Exporter jar从Camel的JMX中获取更详细的度量。我想避免这种html" target="_blank">方法,因为这意味着对于每个Camel Spring Boot应用程序,我将使用2个端口;1个用于JMX度量,1个用于执行器度量。

 类似资料:
  • 如何使用Apache Camel调用带有空消息体的SOAP Web服务? 例如,路由上的最后一个endpoint将是调用我的代理上采用 0 个参数的方法。 编辑: xml配置示例: 问题是 WS 上的方法“invoke”需要 0 个参数,并且会抛出一个异常,指出正在接收 1 个参数。有没有办法让我指定忽略此收到的输入?

  • 我试图使用Apache Camel Quartz2实现一个调度器,它每分钟执行一次路由,并按预期执行一些任务。我使用spring DSL实现与apache camel相关联的路由,如下所示: 根据日志,它不会记录为路由记录的消息,例如Direct:DomainsWithFTPUsers等等。请指导如何实现同样的目标。

  • 遵循官方文件(https://camel.apache.org/manual/component-dsl.html#_using_component_dsl)我创建了以下代码: 但是中的告诉我: 并且中的特性不建议导入相应的库。 有人能给我指出正确的方向吗? 我必须理解的概念才能做到这一点吗?

  • 我使用Spring-Boot2.0.0并尝试公开/acturet/prometheusendpoint。我启用了所有web管理endpoint,但只有prometheusendpoint未公开。有什么帮助吗?

  • 我要监控的应用程序为健康检查提供了一个apiendpoint,该endpoint使用json中的指标进行响应。例如: 我已经设置了Prometheus blackbox\u exporter,以监视此endpoint是否返回200 Ok,但理想情况下,我也希望获得这些指标。我知道instrumentation直接从应用程序导出这些数据。但是,由于应用程序已经在导出json对象中我想要的内容,我更希

  • 考虑到apache Camel,我有一个问题:是否可以通过代码来创建全局拦截器,例如AOP?拦截器应该跳过endpoint还是模仿endpoint? 提前致谢