首页 > 解决方案 > 在 Java 中进行了 Sentry 集成,如下所示。在 Sentry 仪表板上没有收到单个事件。可能是什么原因?

问题描述

  Sentry.init("https://a96e4f7079404e12823024df8367d521@o443980.ingest.sentry.io/5418440");
  sentry = SentryClientFactory.sentryClient();
  logWithStaticAPI();


static  void logWithStaticAPI() {
    // Note that all fields set on the context are optional. Context data is copied onto
    // all future events in the current context (until the context is cleared).

    // Record a breadcrumb in the current context. By default the last 100 breadcrumbs are kept.
    Sentry.getContext().recordBreadcrumb(
            new BreadcrumbBuilder().setMessage("User made an action").build()
    );

    // Set the user in the current context.
    Sentry.getContext().setUser(
            new UserBuilder().setEmail("hello@sentry.io").build()
    );

    // Add extra data to future events in this context.
    Sentry.getContext().addExtra("extra", "thing");

    // Add an additional tag to future events in this context.
    Sentry.getContext().addTag("tagName", "tagValue");

    /*
     This sends a simple event to Sentry using the statically stored instance
     that was created in the ``main`` method.
     */
    Sentry.capture("This is a test");

    try {
        unsafeMethod();
    } catch (Exception e) {
        // This sends an exception event to Sentry using the statically stored instance
        // that was created in the ``main`` method.
        Sentry.capture(e);
    }
}

标签: javasentry

解决方案


回答我自己的问题。它实际上在一天左右后开始工作。所以整合后要耐心等待。


推荐阅读