sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

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

Open dennisja opened this issue 3 years ago • 10 comments
trafficstars

Environment

SaaS (https://sentry.io/)

Version

  • @sentry/browser => 6.3.5
  • @sentry/react => 6.15.0

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

dennisja avatar Mar 21 '22 18:03 dennisja

Routing to @getsentry/team-web-frontend for triage. ⏲️

getsentry-release avatar Mar 22 '22 18:03 getsentry-release

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

AbhiPrasad avatar Mar 23 '22 18:03 AbhiPrasad

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!

Kellercai avatar Mar 24 '22 01:03 Kellercai

@AbhiPrasad Do you have an idea of when this will be worked on? Would like to inform my team about this

dennisja avatar Mar 24 '22 08:03 dennisja

@AbhiPrasad Any update on this?

dennisja avatar Jun 08 '22 08:06 dennisja

@dennisja, there have been lots of changes since this error was initially published. I would recommend you try upgrading to the newest version (atm, it is 7.1.1).

We didn't intentionally try to solve this problem, but it could have been a nice side effect of various changes we did. Solving this properly is on our long term roadmap to be solved late this year.

vladanpaunovic avatar Jun 08 '22 13:06 vladanpaunovic

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?

dennisja avatar Jun 13 '22 09:06 dennisja

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?

allyssonsantos avatar Aug 22 '22 12:08 allyssonsantos

@allyssonsantos The only side-effect is that the current session on the scope will be terminated (if there is one) and replaced with a new one.

lforst avatar Aug 22 '22 16:08 lforst

It looks like it is not related to multiple hubs or clients but any SDK initialization. I'm using the latest 7.13.0 SDK.

For me, only Release Health is not sent.

koyta avatar Sep 19 '22 16:09 koyta

For me as well, I don't seem to get any Release Health on my react app although the release and source map are configured. I also have a react-native app that does have a working Release Health, when I compared the two SDK initialization there was no difference to demonstrate why this happens

ODVault avatar Jan 23 '23 12:01 ODVault

@ODVault do you have a release value configured?

lforst avatar Jan 23 '23 14:01 lforst

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Aug 18 '23 07:08 getsantry[bot]

any update about this issue?

gsanchqu avatar Aug 18 '23 15:08 gsanchqu

Hi, no update, this remains backlogged and we're still waiting on a responds RE

@ODVault do you have a release value configured?

Lms24 avatar Aug 23 '23 07:08 Lms24

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Sep 14 '23 07:09 getsantry[bot]