diff --git a/二、技术文档/其他/容器服务平台-操作手册/搭建与使用遥测系统.md b/二、技术文档/其他/容器服务平台-操作手册/搭建与使用遥测系统.md index 5203f1a..f9a5eea 100644 --- a/二、技术文档/其他/容器服务平台-操作手册/搭建与使用遥测系统.md +++ b/二、技术文档/其他/容器服务平台-操作手册/搭建与使用遥测系统.md @@ -173,6 +173,7 @@ overrides: loki配置文件: +```yml # For more information on this configuration, see the complete reference guide at # https://grafana.com/docs/loki/latest/configure/ @@ -213,9 +214,11 @@ schema_config: ruler: alertmanager_url: http://localhost:9093 +``` prometheus配置文件: +```yml # For more information on this configuration, see the complete reference guide at # https://prometheus.io/docs/prometheus/latest/configuration/configuration/ @@ -226,9 +229,11 @@ scrape_configs: - job_name: aggregated-trace-metrics static_configs: - targets: ['otel:8889'] +``` opentelemetry collector配置文件: +```yml # For more information on this configuration, see the complete reference guide at # https://opentelemetry.io/docs/collector/configuration/ @@ -277,11 +282,13 @@ service: metrics/spanmetrics: receivers: [spanmetrics] exporters: [debug, prometheus] +``` # **后端服务收集遥测数据** 分别下载 [opentelemetry-javaagent.jar](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar) 和 [ot-java-agent-extension-1.28.0.jar](https://github.com/alibabacloud-observability/opentelemetry-best-practice/raw/main/opentelemetry-javaagent-extension/ot-java-agent-extension-1.28.0.jar) 放在 /opt/agent 目录。然后用以下命令启动应用: +```shell # For more information on this configuration, see the complete reference guide at # https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure @@ -291,9 +298,11 @@ java -javaagent:/opt/agent/opentelemetry-javaagent.jar \ -Dotel.service.name=xxx \ -Dotel.logs.exporter=otlp \ -jar xxx.jar + ``` opentelemetry-javaagent 会对一些库自动记录 Span,如果想要追加一些 Span 以便更精细地追踪,则需要通过注解来控制: +```xm io.opentelemetry.instrumentation @@ -336,5 +345,5 @@ public class MyClass { ![](https://dev.rzdata.net/download/attachments/49905677/image2023-12-29_10-48-9.png?version=1&modificationDate=1703818150000&api=v2 "知识库 > 搭建与使用遥测系统 > image2023-12-29_10-48-9.png")![](https://dev.rzdata.net/download/attachments/49905677/image2023-12-29_10-47-44.png?version=1&modificationDate=1703818150000&api=v2 "知识库 > 搭建与使用遥测系统 > image2023-12-29_10-47-44.png")![](https://grafana.com/api/dashboards/19419/images/15023/image) \ No newline at end of file