我们为应用配置、事件中心、Azure Cosmos DB、Key Vault、存储 Blob、存储队列和存储文件以及 Spring Cloud Sleuth 支持所有基于 HTTP 的 Azure SDK 添加了运行状况指示器。 例如,现在可以探测以确定存储 Blob 是通过 Spring Boot 执行器终结点启动还是关闭,以及跟踪从应用程序到 Key Vault 的依赖项和延迟。
启用运行状况指示器
若要启用运行状况指示器,请将 Spring Cloud Azure 执行器初学者依赖项添加到 pom.xml 文件中。 此依赖项还将包括 spring-boot-starter-actuator。
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-actuator</artifactId>
</dependency>
下表列出了可用于启用或禁用每个 Azure 服务的运行状况指示器的可配置属性:
| Azure 服务 | 财产 |
|---|---|
| 应用程序配置 | management.health.azure-appconfiguration.enabled |
| Azure Cosmos DB | management.health.azure-cosmos.enabled |
| 事件中心 | management.health.azure-eventhubs.enabled |
| Key Vault 证书 | management.health.azure-keyvault-certificate.enabled |
| Key Vault 机密 | management.health.azure-keyvault-secret.enabled |
| 存储 Blob | management.health.azure-storage-blob.enabled |
| 存储文件共享 | management.health.azure-storage-fileshare.enabled |
| 存储队列 | management.health.azure-storage-queue.enabled |
重要
调用 Azure 服务的运行状况终结点可能会导致额外费用。 例如,如果调用 http://HOST_NAME:{port}/actuator/health/cosmos 来获取 Azure Cosmos DB 运行状况信息,它将计算请求单位(RU)。 有关详细信息,请参阅 Azure Cosmos DB中的
注意
若要调用 Cosmos的运行状况终结点,应配置选项 spring.cloud.azure.cosmos.database;否则,将返回 unknown 的运行状况。
若要调用 Storage Queue的运行状况终结点,如果 Storage Account Contributor 用于授权,则需要 Azure AD 的角色。
启用 seuth
若要使用 Spring Cloud Sleuth 跟踪 Azure SDK 活动,请将以下 Spring Cloud Azure Trace Sleuth 依赖项添加到 pom.xml 文件中:
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-trace-sleuth</artifactId>
</dependency>
注意
目前仅支持基于 HTTP 的 Azure SDK 客户端。 例如,目前不支持使用 AMQP 传输的事件中心和服务总线。 对于这些要求,我们建议使用 Azure Application Insight。