Sentry-Java线上出错

2021-09-06  本文已影响0人  天草二十六_简村人

一.报错信息

在sentry.debug=true开启调试模式下,报错信息见下

DEBUG: Capturing event: c641f3d1ad514acaa8022440238e73c6
INFO: Session is null on scope.withSession
ERROR: Request failed, API returned 400
ERROR: {"detail":"empty envelope"}

二.pom.xml

        <dependency>
            <groupId>io.sentry</groupId>
            <artifactId>sentry-spring-boot-starter</artifactId>
            <version>4.3.0</version>
        </dependency>
        <dependency>
            <groupId>io.sentry</groupId>
            <artifactId>sentry-logback</artifactId>
            <version>4.3.0</version>
        </dependency>

        <!-- gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.6.2</version>
        </dependency>

三.sentry依赖gson

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- This module was also published with a richer model, Gradle metadata,  -->
  <!-- which should be used instead. Do not delete the following line which  -->
  <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
  <!-- that they should prefer consuming it instead. -->
  <!-- do_not_remove: published-with-gradle-metadata -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.sentry</groupId>
  <artifactId>sentry</artifactId>
  <version>4.3.0</version>
  <name>io.sentry:sentry</name>
  <description>SDK for sentry.io</description>
  <url>https://github.com/getsentry/sentry-java</url>
  <licenses>
    <license>
      <name>MIT</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>getsentry</id>
      <name>Sentry Team and Contributors</name>
      <email>oss@sentry.io</email>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:git://github.com/getsentry/sentry-java.git</connection>
    <developerConnection>scm:git:ssh://github.com:getsentry/sentry-java.git</developerConnection>
    <url>https://github.com/getsentry/sentry-java/tree/main</url>
  </scm>
  <dependencies>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.8.5</version>
      <scope>runtime</scope>
    </dependency>
  </dependencies>
</project>

四.上报成功的提示:

DEBUG: Capturing event: f2e8c2b920384f3eaf45158137582a03
INFO: Session is null on scope.withSession
DEBUG: Envelope sent successfully.
DEBUG: Envelope flushed

五.去掉gson的依赖

        <dependency>
            <groupId>io.sentry</groupId>
            <artifactId>sentry-spring-boot-starter</artifactId>
            <version>4.3.0</version>
        </dependency>
        <dependency>
            <groupId>io.sentry</groupId>
            <artifactId>sentry-logback</artifactId>
            <version>4.3.0</version>
        </dependency>

参考github官网issue: https://github.com/getsentry/sentry-java/issues/1497

上一篇 下一篇

猜你喜欢

热点阅读