第 3 章 在 JBoss EAP 中管理 MicroProfile
3.1. MicroProfile 遥测管理 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
3.1.1. 使用管理 CLI 添加 MicroProfile Telemetry 子系统 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
MicroProfile 遥测组件通过 microprofile-telemetry
子系统集成到默认的 MicroProfile 配置中。如果尚未包含子系统,您还可以使用管理 CLI 添加 MicroProfile 遥测子系统。
先决条件
- 在添加 MicroProfile Telemetry 子系统之前,必须将 OpenTelemetry 子系统添加到配置中。MicroProfile 遥测子系统依赖于 OpenTelemetry 子系统。
流程
- 打开终端。
运行以下命令:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.2. 启用 MicroProfile Telemetry 子系统 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
MicroProfile Telemetry 默认为禁用,必须基于每个应用程序启用。
先决条件
- MicroProfile Telemetry 子系统已添加到配置中。
- OpenTelemetry 子系统已添加到配置中。
流程
-
打开
microprofile-config.properties
文件。 将
otel.sdk.disabled
属性设置为false
:otel.sdk.disabled=false
otel.sdk.disabled=false
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.3. 使用 MicroProfile 配置覆盖服务器配置 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
您可以使用 MicroProfile Config 覆盖 MicroProfile Telemetry 子系统中个别应用的服务器配置。
例如,导出的 trace 中使用的服务名称与部署存档相同。如果部署存档设置为 my-application-1.0.war
,则服务名称将相同。要覆盖此配置,您可以更改配置文件中的 otel.service.name
属性的值:
otel.service.name=My Application
otel.service.name=My Application