Micrometer Integration

本节记录了与 Micrometer 的集成。有关与 Micrometer Observation 集成的信息,请参阅 Micrometer Observation

This section documents the integration with Micrometer. For integration with Micrometer Observation, see Micrometer Observation.

从版本 2.2 开始,如果在类路径上检测到 Micrometer,并且应用程序上下文中存在一个 MeterRegistry(或恰好有一个标有 @Primary,例如在使用 Spring Boot 时),监听器容器将自动为监听器创建并更新 Micrometer Timer。可以通过将容器属性 micrometerEnabled 设置为 false 来禁用计时器。

Starting with version 2.2, the listener containers will automatically create and update Micrometer Timer s for the listener, if Micrometer is detected on the class path, and a single MeterRegistry is present in the application context (or exactly one is annotated @Primary, such as when using Spring Boot). The timers can be disabled by setting the container property micrometerEnabled to false.

维护着两个计时器——一个用于对监听器的成功调用,另一个用于失败。对于简单的 MessageListener,为每个配置的队列保留一对计时器。

Two timers are maintained - one for successful calls to the listener and one for failures. With a simple MessageListener, there is a pair of timers for each configured queue.

计时器名称为 spring.rabbitmq.listener,具有以下标记:

The timers are named spring.rabbitmq.listener and have the following tags:

  • listenerId : (listener id or container bean name)

  • queue : (the queue name for a simple listener or list of configured queue names when consumerBatchEnabled is true - because a batch may contain messages from multiple queues)

  • result : success or failure

  • exception : none or ListenerExecutionFailedException

你可以使用 micrometerTags 容器属性添加额外的标签。

You can add additional tags using the micrometerTags container property.