我有一個帶有 Spring Cloud Sleuth、OpenTelemetry 儀器和 OpenTelemetry 匯出器 OTLP 的 Spring Boot 應用程式。
這是依賴項的要點:
spring-cloud-starter-sleuth沒有 Brave,因為我們使用的是 OpenTelemetry 儀器spring-cloud-sleuth-otel-autoconfigure它引入了 OpenTelemetry 儀器庫并提供了 Spring 自動配置opentelemetry-exporter-otlp用于向 apm 服務器發送資料<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId> <exclusions> <exclusion> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-sleuth-brave</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-sleuth-otel-autoconfigure</artifactId> </dependency> <dependency> <groupId>io.opentelemetry</groupId> <artifactId>opentelemetry-exporter-otlp</artifactId> </dependency> <!-- https://mvnrepository.com/artifact/io.grpc/grpc-netty --> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-netty-shaded</artifactId> <version>1.43.0</version> </dependency>
我的只有基本配置application.yml:
spring:
sleuth:
enabled: true
otel:
config:
trace-id-ratio-based: 1.0
exporter:
otlp:
endpoint: http://localhost:8200
通過這個設定,我成功地在 APM 中看到了一些資料。示例螢屏:


但是,如果我查看 Elastic 檔案,我會發現他們的螢屏上有額外的資料:Traces。
對我來說,看起來跨度和事務名稱丟失(我只看到 HTTP GET 而不是名稱),至少它們存在于檔案影像中。
任何人都知道為什么會發生這種情況以及如何解決這個問題?
這是 Elastic 中的示例跟蹤檔案:
顯示代碼片段
const EXAMPLE = {
"_index": "apm-7.15.2-metric-000001",
"_type": "_doc",
"_id": "AYVKCH8BxjGANUnHPDgq",
"_version": 1,
"_score": 1,
"_source": {
"_doc_count": 2,
"agent": {
"name": "opentelemetry/java"
},
"processor": {
"name": "metric",
"event": "metric"
},
"transaction.duration.histogram": {
"counts": [
1,
1
],
"values": [
1439,
10495
]
},
"metricset.name": "transaction",
"observer": {
"hostname": "0798ff612508",
"id": "6a12bcef-5e7e-45b3-aee6-f2af4e175c3f",
"ephemeral_id": "389ee9b1-d4c4-4d67-b46a-bfcaa77b7b79",
"type": "apm-server",
"version": "7.15.2",
"version_major": 7
},
"@timestamp": "2022-02-17T15:25:56.160Z",
"timeseries": {
"instance": "summary-service:HTTP GET:11ed2dc65a946e45"
},
"ecs": {
"version": "1.11.0"
},
"service": {
"name": "summary-service"
},
"event": {
"ingested": "2022-02-17T15:25:57.161730700Z",
"outcome": "success"
},
"transaction": {
"result": "HTTP 2xx",
"root": true,
"name": "HTTP GET",
"type": "request"
}
},
"fields": {
"transaction.name.text": [
"HTTP GET"
],
"_doc_count": [
2
],
"service.name": [
"summary-service"
],
"processor.name": [
"metric"
],
"observer.version_major": [
7
],
"observer.hostname": [
"0798ff612508"
],
"transaction.result": [
"HTTP 2xx"
],
"transaction.duration.histogram": [
{
"counts": [
1,
1
],
"values": [
1439,
10495
]
}
],
"transaction.type": [
"request"
],
"metricset.name": [
"transaction"
],
"observer.id": [
"6a12bcef-5e7e-45b3-aee6-f2af4e175c3f"
],
"event.ingested": [
"2022-02-17T15:25:57.161Z"
],
"@timestamp": [
"2022-02-17T15:25:56.160Z"
],
"observer.ephemeral_id": [
"389ee9b1-d4c4-4d67-b46a-bfcaa77b7b79"
],
"timeseries.instance": [
"summary-service:HTTP GET:11ed2dc65a946e45"
],
"observer.version": [
"7.15.2"
],
"ecs.version": [
"1.11.0"
],
"observer.type": [
"apm-server"
],
"transaction.root": [
true
],
"processor.event": [
"metric"
],
"transaction.name": [
"HTTP GET"
],
"agent.name": [
"opentelemetry/java"
],
"event.outcome": [
"success"
]
}
}
uj5u.com熱心網友回復:
對我來說,看起來跨度和事務名稱丟失(我只看到 HTTP GET 而不是名稱)
不,他們沒有失蹤。您看到 name as 的原因HTTP GET是由于偏好較少的基數名稱和跟蹤資料的語意約定。這里有關于 HTTP 跨度命名約定的詳細說明https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#name。自動檢測庫生成的任何資料都將遵守語意約定規范。我猜測來自鏈接供應商的可視化來自手動工具,您作為最終用戶可以在其中提供任何名稱(盡管建議每個人都使用較少的基數,但那里沒有強制執行)。我認為這里沒有什么可以“修復”的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/428930.html
上一篇:使用動態映射創建索引
下一篇:彈性搜索-搜索忽略句點的資料或
