Creates a new instance of the hub, will push one Layer into the internal stack on creation.
Instantiation of Hub objects is deprecated and the constructor will be removed in version 8 of the SDK.
If you are currently using the Hub for multi-client use like so:
// OLD
const hub = new Hub();
hub.bindClient(client);
makeMain(hub)
instead initialize the client as follows:
// NEW
Sentry.withIsolationScope(() => {
Sentry.setCurrentClient(client);
client.init();
});
If you are using the Hub to capture events like so:
// OLD
const client = new Client();
const hub = new Hub(client);
hub.captureException()
instead capture isolated events as follows:
// NEW
const client = new Client();
const scope = new Scope();
scope.setClient(client);
scope.captureException();
Optional
hint: BreadcrumbHintOptional
level: Severity | SeverityLevelOptional
hint: EventHintStarts a new Transaction
and returns it. This is the entry point to manual tracing instrumentation.
A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
new child span within the transaction or any span, call the respective .startChild()
method.
Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
The transaction must be finished with a call to its .end()
method, at which point the transaction with all its
finished child spans will be sent to Sentry.
Properties of the new Transaction
.
Optional
customSamplingContext: CustomSamplingContextInformation given to the transaction sampling function (along with context-dependent default values). See Options.tracesSampler.
The transaction which was just started
Deprecated
The
Hub
class will be removed in version 8 of the SDK in favour ofScope
andClient
objects.If you previously used the
Hub
class directly, replace it withScope
andClient
objects. More information:Some of our APIs are typed with the Hub class instead of the interface (e.g.
getCurrentHub
). Most of them are deprecated themselves and will also be removed in version 8. More information: