Description
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/browser
-
@sentry/node
-
raven-js
-
raven-node
(raven for node) - other:
@sentry/react
Version:
@sentry/browser: 6.15.0
@sentry/react: 6.15.0
Description
My client consists of a platform with a global Sentry (using Sentry.init
) and micro services that each has its own Sentry Hub with a different DSN (using new Sentry.Hub
).
When I try and use transactions, I see that only the global Sentry can send transactions, and all of my micro services transactions reporting are "failing silently" (I don't see any request on the Network Tab).
I also tried to reproduce it on the same app and I encountered the issue.
Is it by design? Can I make it work somehow?
// App.ts
import * as Sentry from '@sentry/react'; // tried with @sentry/browser as well
Sentry.init({
dsn: 'XXXXXXXXXXXXXXXX',
integrations: [
new Integrations.BrowserTracing(),
],
// for the sake of debugging
tracesSampleRate: 1.0,
beforeSend(event) {
// some unrelated logic
return event;
},
});
This component reports transactions for the global/main Sentry:
// AmazingComponent.ts
import * as Sentry from '@sentry/react';
const transaction = Sentry.startTransaction({ name: 'shopCheckout' });
console.log('After transaction start, before finish');
transaction.finish(); // Reports this transaction!
This component doesn't reports transactions for the a Sentry Hub:
// CoolComponent.ts
import * as Sentry from '@sentry/react';
const newHub = new Sentry.Hub(
new Sentry.BrowserClient({
dsn: 'YYYYYYYYYYYYYYYYY', // different DSN than the Sentry.init one
integrations: [
new Integrations.BrowserTracing(),
],
}),
);
const newHubTransaction = newHub.startTransaction({
name: 'InnerTransaction',
});
console.log('After Hub transaction start, before finish');
newHubTransaction.finish(); // nothing is reported to Sentry
P.S
I can report exceptions via the Hub (i.e using newHub.captureException(...)
is being reported successfully).
P.S 2 🎮 😉
I don't think a solution involving makeMain
each time I want to report a transaction is valid, because I have many micro services that can report at the same time...