Health Indicator

运行状况指示器需要依赖项 spring-boot-starter-actuator。对于 maven 使用:

The health indicator requires the dependency spring-boot-starter-actuator. For maven use:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Spring Cloud Stream Kafka 流绑定程序提供了一个健康指示符,用来检查基础流线程的状态。Spring Cloud Stream 定义了一个属性 management.health.binders.enabled 以启用健康指示符。参见 Spring Cloud Stream documentation

Spring Cloud Stream Kafka Streams Binder provides a health indicator to check the state of the underlying streams threads. Spring Cloud Stream defines a property management.health.binders.enabled to enable the health indicator. See the Spring Cloud Stream documentation.

运行状况指示器为每个流线程的元数据提供以下详细信息:

The health indicator provides the following details for each stream thread’s metadata:

  • Thread name

  • Thread state: CREATED, RUNNING, PARTITIONS_REVOKED, PARTITIONS_ASSIGNED, PENDING_SHUTDOWN or DEAD

  • Active tasks: task ID and partitions

  • Standby tasks: task ID and partitions

默认情况下,只有全局状态可见(UP`或 `DOWN)。要显示详细信息,必须将属性 management.endpoint.health.show-details`设置为 `ALWAYS`或 `WHEN_AUTHORIZED。有关运行状况信息的更多详细信息,请参阅 Spring Boot Actuator documentation

By default, only the global status is visible (UP or DOWN). To show the details, the property management.endpoint.health.show-details must be set to ALWAYS or WHEN_AUTHORIZED. For more details about the health information, see the Spring Boot Actuator documentation.

如果所有注册的 Kafka 线程处于 RUNNING 状态,则运行状况指示器的状态为 UP

The status of the health indicator is UP if all the Kafka threads registered are in the RUNNING state.

由于 Kafka Streams 绑定中有三个单独的绑定 (KStreamKTableGlobalKTable),它们都会报告运行状况状态。启用 show-details 时,报告的部分信息可能冗余。

Since there are three individual binders in Kafka Streams binder (KStream, KTable and GlobalKTable), all of them will report the health status. When enabling show-details, some of the information reported may be redundant.

当同一应用程序中存在多个 Kafka Streams 处理器时,将报告所有处理器的运行状况检查,并将按照 Kafka Streams 的应用程序 ID 对其进行分类。

When there are multiple Kafka Streams processors present in the same application, then the health checks will be reported for all of them and will be categorized by the application ID of Kafka Streams.