二、技术文档/其他/容器服务平台-操作手册/搭建与使用遥测系统.md updated

This commit is contained in:
jiangdingxuan 2024-02-20 15:00:54 +08:00
parent abcb352ef6
commit b19184987a

View File

@ -173,6 +173,7 @@ overrides:
loki配置文件 loki配置文件
```yml
# For more information on this configuration, see the complete reference guide at # For more information on this configuration, see the complete reference guide at
# https://grafana.com/docs/loki/latest/configure/ # https://grafana.com/docs/loki/latest/configure/
@ -213,9 +214,11 @@ schema_config:
ruler: ruler:
alertmanager_url: http://localhost:9093 alertmanager_url: http://localhost:9093
```
prometheus配置文件 prometheus配置文件
```yml
# For more information on this configuration, see the complete reference guide at # For more information on this configuration, see the complete reference guide at
# https://prometheus.io/docs/prometheus/latest/configuration/configuration/ # https://prometheus.io/docs/prometheus/latest/configuration/configuration/
@ -226,9 +229,11 @@ scrape_configs:
- job_name: aggregated-trace-metrics - job_name: aggregated-trace-metrics
static_configs: static_configs:
- targets: ['otel:8889'] - targets: ['otel:8889']
```
opentelemetry collector配置文件 opentelemetry collector配置文件
```yml
# For more information on this configuration, see the complete reference guide at # For more information on this configuration, see the complete reference guide at
# https://opentelemetry.io/docs/collector/configuration/ # https://opentelemetry.io/docs/collector/configuration/
@ -277,11 +282,13 @@ service:
metrics/spanmetrics: metrics/spanmetrics:
receivers: [spanmetrics] receivers: [spanmetrics]
exporters: [debug, prometheus] 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 目录。然后用以下命令启动应用: 分别下载 [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 # For more information on this configuration, see the complete reference guide at
# https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure # 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.service.name=xxx \
-Dotel.logs.exporter=otlp \ -Dotel.logs.exporter=otlp \
-jar xxx.jar -jar xxx.jar
```
opentelemetry-javaagent 会对一些库自动记录 Span如果想要追加一些 Span 以便更精细地追踪,则需要通过注解来控制: opentelemetry-javaagent 会对一些库自动记录 Span如果想要追加一些 Span 以便更精细地追踪,则需要通过注解来控制:
```xm
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>io.opentelemetry.instrumentation</groupId> <groupId>io.opentelemetry.instrumentation</groupId>
@ -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) ![](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)
<!--stackedit_data: <!--stackedit_data:
eyJoaXN0b3J5IjpbLTUwNzcwMjcwMV19 eyJoaXN0b3J5IjpbMTUxNzEzMjcxNF19
--> -->