Spring Boot 使用opentelemetry-java将Sping Boot 从3.1.3升级到3.2.0后,可观察性堆栈中出现异常

f0ofjuux  于 2024-01-06  发布在  Spring
关注(0)|答案(1)|浏览(168)

问题:

使用OTel Java SDKobservability堆栈从Sping Boot 版本3.1.3升级到3.2.0时,会遇到以下异常:

  1. 2023-11-26T16:00:43.087Z WARN [order service,,] 1 --- [order service] [BatchSpanProcessor_WorkerThread-1] [] i.o.exporter.zipkin.ZipkinSpanExporter : Failed to export spans
  2. org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: "valid annotation timestamp required<EOL>"
  3. at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:103)
  4. at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:183)
  5. at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:137)
  6. at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
  7. at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:932)
  8. at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:881)
  9. at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:781)
  10. at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:663)
  11. at org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinRestTemplateSender$RestTemplateHttpPostCall.doExecute(ZipkinRestTemplateSender.java:68)
  12. at org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinRestTemplateSender$RestTemplateHttpPostCall.doEnqueue(ZipkinRestTemplateSender.java:75)
  13. at zipkin2.Call$Base.enqueue(Call.java:406)
  14. at io.opentelemetry.exporter.zipkin.ZipkinSpanExporter.export(ZipkinSpanExporter.java:82)
  15. at io.micrometer.tracing.otel.bridge.CompositeSpanExporter.lambda$export$3(CompositeSpanExporter.java:88)
  16. at java.base/java.lang.Iterable.forEach(Iterable.java:75)
  17. at io.micrometer.tracing.otel.bridge.CompositeSpanExporter.export(CompositeSpanExporter.java:88)
  18. at io.opentelemetry.sdk.trace.export.BatchSpanProcessor$Worker.exportCurrentBatch(BatchSpanProcessor.java:327)
  19. at io.opentelemetry.sdk.trace.export.BatchSpanProcessor$Worker.run(BatchSpanProcessor.java:245)
  20. at java.base/java.lang.Thread.run(Thread.java:833)

字符串

配置:

Sping Boot 版本:3.2.0

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>3.2.0</version>
  5. <relativePath/> <!-- lookup parent from repository -->
  6. </parent>


跟踪不一致性:

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-actuator</artifactId>
  4. </dependency>
  5. <dependency>
  6. <groupId>io.micrometer</groupId>
  7. <artifactId>micrometer-tracing-bridge-otel</artifactId>
  8. </dependency>
  9. <dependency>
  10. <groupId>io.opentelemetry</groupId>
  11. <artifactId>opentelemetry-exporter-zipkin</artifactId>
  12. </dependency>

意见:

在Sping Boot 版本3.2.0中使用observability堆栈时遇到HttpClientErrorException$BadRequest异常。版本3.1.3不会出现此问题。
任何见解或协助解决这个问题将不胜感激。

编辑-1:
复制步骤

  • 克隆存储库:food-delivery-backend
  • checkout 分支/tag:v3.2.0
  • 查看README.md了解如何运行
  • 现在检查Grafana中的order API日志
    其他信息
  • 工作样品( Spring Boot 3.2.0):
  • v3.2.0/restaurant-未观察到问题。
  • 不合格样本(Sping Boot 3.2.0):
  • v3.2.0/order-发生异常。
    编辑-2:
  • 对于braveopentelemetry-java依赖项使用Sping Boot 版本3.1.3时不存在错误-Example
  • 该问题似乎与Sping Boot 3.2.0与opentelemetry-java之间的交互有关
    编辑-3:
    Sping Boot 3.2.0使用以下跟踪版本
  1. <dependency>
  2. <groupId>io.micrometer</groupId>
  3. <artifactId>micrometer-tracing-bridge-otel</artifactId>
  4. <version>1.2.0</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>io.opentelemetry</groupId>
  8. <artifactId>opentelemetry-exporter-zipkin</artifactId>
  9. <version>1.31.0</version>
  10. </dependency>

Sping Boot 3.1.3使用以下跟踪版本

  1. <dependency>
  2. <groupId>io.micrometer</groupId>
  3. <artifactId>micrometer-tracing-bridge-otel</artifactId>
  4. <version>1.1.4</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>io.opentelemetry</groupId>
  8. <artifactId>opentelemetry-exporter-zipkin</artifactId>
  9. <version>1.25.0</version>
  10. </dependency>


我尝试使用Sping Boot 3.2.0对跟踪版本进行不同的排列,以确定导致异常的特定依赖项。然而,以下组合仍然存在问题:
1.** Spring Boot 3.2.0与千分尺跟踪1.2.0和OTel导出器Zipkin 1.25.0**
产品编号:GitHub Link

  1. <dependency>
  2. <groupId>io.micrometer</groupId>
  3. <artifactId>micrometer-tracing-bridge-otel</artifactId>
  4. <version>1.2.0</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>io.opentelemetry</groupId>
  8. <artifactId>opentelemetry-exporter-zipkin</artifactId>
  9. <version>1.25.0</version>
  10. </dependency>


1.** Spring Boot 3.2.0与千分尺跟踪1.1.4和OTel导出器Zipkin 1.31.0**
产品编号:GitHub Link

  1. <dependency>
  2. <groupId>io.micrometer</groupId>
  3. <artifactId>micrometer-tracing-bridge-otel</artifactId>
  4. <version>1.1.4</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>io.opentelemetry</groupId>
  8. <artifactId>opentelemetry-exporter-zipkin</artifactId>
  9. <version>1.31.0</version>
  10. </dependency>


在这两种情况下,异常仍然存在。目前还不清楚跟踪版本与Sping Boot 3.2.0的具体组合会触发该问题。

编辑-4:

在实现了@Jonatan Ivanov在评论中建议的最小设置后,我建立了两个配置-一个使用H2数据库,另一个在H2之上合并了用于千分尺跟踪的datasource-micrometer-spring-boot依赖项。在执行具有datasource-micrometer-spring-boot依赖项的应用程序时,我在日志中遇到了一个错误,表明该特定依赖项存在潜在问题。
下面是依赖关系配置:

  1. <dependency>
  2. <groupId>net.ttddyy.observation</groupId>
  3. <artifactId>datasource-micrometer-spring-boot</artifactId>
  4. <version>1.0.2</version>
  5. </dependency>


以下是相应的GitHub链接:
1.只有H2:GitHub Repository - Only H2
1.带H2和datasource-micrometer-spring-bootGitHub Repository - H2 and Micrometer Tracing
我还在项目中提出了一个GitHub问题,可以在以下位置找到:GitHub Issue - datasource-micrometer

dfddblmv

dfddblmv1#

由于在这方面的合作,千分尺跟踪中的一个错误是identified,然后发布了fixed1.2.1)。请升级您的千分尺跟踪版本以使用至少1.2.1(您也可以等到下一个 Boot 版本(3.2.1),因为它应该会选择修复的版本)。

相关问题