二、技术文档/其他/容器服务平台-操作手册/搭建与使用遥测系统.md updated
This commit is contained in:
parent
abcb352ef6
commit
b19184987a
@ -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
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.opentelemetry.instrumentation</groupId>
|
||||
@ -336,5 +345,5 @@ public class MyClass {
|
||||
|
||||

|
||||
<!--stackedit_data:
|
||||
eyJoaXN0b3J5IjpbLTUwNzcwMjcwMV19
|
||||
eyJoaXN0b3J5IjpbMTUxNzEzMjcxNF19
|
||||
-->
|
Loading…
x
Reference in New Issue
Block a user