From b19184987a6329255010f8b115cf77435731e479 Mon Sep 17 00:00:00 2001 From: jiangdingxuan Date: Tue, 20 Feb 2024 15:00:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E3=80=81=E6=8A=80=E6=9C=AF=E6=96=87?= =?UTF-8?q?=E6=A1=A3/=E5=85=B6=E4=BB=96/=E5=AE=B9=E5=99=A8=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=B9=B3=E5=8F=B0-=E6=93=8D=E4=BD=9C=E6=89=8B?= =?UTF-8?q?=E5=86=8C/=E6=90=AD=E5=BB=BA=E4=B8=8E=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E9=81=A5=E6=B5=8B=E7=B3=BB=E7=BB=9F.md=20updated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../搭建与使用遥测系统.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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