sentry-javascript: Using sentry hub doesn't send release health and performance metrics

Environment

SaaS (https://sentry.io/)

Version

Steps to Reproduce

Description

We are using Sentry Hub because we have more than one project on each page with each using a different Sentry project. The errors for each project are reported properly but some metrics are missing

Steps

  • Create a react sentry project
  • Use the Sentry hub + Browser client to initialize Sentry and capture errors instead of using Sentry.init ie.
import {
  BrowserClient,
  Hub,
  reactRouterV5Instrumentation,
  defaultIntegrations,
} from '@sentry/react';
import { Integrations } from '@sentry/tracing';

const client = new BrowserClient({
    dsn: sentryDSN,
    release: appName,
    environment: ENV,
    integrations: [
      ...defaultIntegrations,
      new Integrations.BrowserTracing({
          routingInstrumentation: reactRouterV5Instrumentation(
            appBrowserHistory
          ),
      }),
    ],
    tracesSampleRate: 0.2,
  });

  const SentryHub = new Hub(client);
  • Use hub to send errors
SentryHub.captureException(error)

Expected Result

  • Should send the errors to the specified project => this works
  • Should report deploys if tracking deploys is setup => this works
  • Should send Crash Free Sessions, Apdex and Releases information => Not sent
  • Should send performance metrics => Not sent

Actual Result

  • Performance metrics not sent
  • Release Health metrics not sent

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Hello @vladanpaunovic Thanks for the reply. I updated one of the apps to the latest version (7.1.1) and haven’t noticed any changes in either release health or performance metrics.

Are there any expected changes to any of the metrics after the upgrade?

Hi! I’m in the same situation as everyone, two clients of Sentry on the same page.

I was able to make release health work (adoption/crash-free rate) on a module-federated component by calling manually on its Sentry initialization:

hub.run((currentHub) => {
  currentHub.withScope(() => {
    currentHub.startSession();
    currentHub.captureSession();
  });
});

I’ve noticed that the autoSessionTracking option that’s supposed to be true by default wasn’t working; even if I set it true by hand, it won’t track sessions, so, calling by hand made it work.

Does anyone know if this approach can cause some side effects? Is it the correct way to do it?

Hi, the same problem, I want to know when can it be fixed? Now I can’t get Web Vitals using sentry hub, it can be achieved using sentry init. Thanks for open source, looking forward to your reply!

Transferring this to the JS SDK repo. This is a known issue, backlogging.