@sentry/core
Advanced tools
Changelog
7.93.0
As we're moving closer to the next major version of the SDK, more public APIs were deprecated.
To get a head start on migrating to the replacement APIs, please take a look at our migration guide.
getActiveTransaction()
& scope.getTransaction()
(#10098)Hub.shouldSendDefaultPii
(#10062)new Transaction()
(#10125)scope.getSpan()
& scope.setSpan()
(#10114)scope.setTransactionName()
(#10113)span.startChild()
(#10091)startTransaction()
(#10073)Transaction.getDynamicSamplingContext
in favor of getDynamicSamplingContextFromSpan
(#10094)startSpan()
(#10101)Scope
(#10039)name
and description
(#10056)tags
, data
, context
& setters (#10053)span.sampled
in favor of span.isRecording()
(#10034)lastEventId
on scope (#10093)node-schedule
libraryThis release adds auto instrumented check-ins for the node-schedule
library.
import * as Sentry from '@sentry/node';
import * as schedule from 'node-schedule';
const scheduleWithCheckIn = Sentry.cron.instrumentNodeSchedule(schedule);
const job = scheduleWithCheckIn.scheduleJob('my-cron-job', '* * * * *', () => {
console.log('You will see this message every minute');
});
node-schedule
library (#10086)span.spanContext()
(#10037)spanToJSON()
method to get span properties (#10074)scope
to startSpan
APIs (#10076)getModuleFromFilename
compatible with ESM (#10061)parameterize
function (#9145)setup
for integration on client multiple times (#10116)LocalVariables
integration should have correct name (#10084)event_id
(#10068)LocalVariables
(#10077)Changelog
7.92.0
span.updateName()
and deprecate span.setName()
(#10018)span.getTraceContext()
(#10032)span.toTraceparent()
in favor of spanToTraceHeader()
util (#10031)trace
in favor of startSpan
(#10012)toContext()
and updateWithContext()
(#10030)deepReadDirSync
(#10016)lastEventId()
(#10043)Please take a look at the Migration docs for more details. These methods will be removed in the upcoming v8 major release.
cron
and node-cron
librariescron
library (#9999)node-cron
library (#9904)This release adds instrumentation for the cron
and node-cron
libraries. This allows you to monitor your cron jobs
with Sentry cron monitors.
For cron
:
import * as Sentry from '@sentry/node';
import { CronJob } from 'cron';
const CronJobWithCheckIn = Sentry.cron.instrumentCron(CronJob, 'my-cron-job');
// use the constructor
const job = new CronJobWithCheckIn('* * * * *', () => {
console.log('You will see this message every minute');
});
// or from
const job = CronJobWithCheckIn.from({
cronTime: '* * * * *',
onTick: () => {
console.log('You will see this message every minute');
},
});
For node-cron
:
import * as Sentry from '@sentry/node';
import cron from 'node-cron';
const cronWithCheckIn = Sentry.cron.instrumentNodeCron(cron);
cronWithCheckIn.schedule(
'* * * * *',
() => {
console.log('running a task every minute');
},
{ name: 'my-cron-job' },
);
enabled
option to Astro integration options (#10007)attributes
to Span
(#10008)setClient()
and getClient()
to Scope
(#10055)captureErrorCause
in ExtraErrorData
integration (#9914)withScope
sets current scope correctly with async callbacks (#9974)NODE_VERSION
properties required (#9964)Work in this release contributed by @joshkel. Thank you for your contribution!
Changelog
7.91.0
The release adds alpha support for Sentry developer metrics in
the server runtime SDKs (@sentry/node
, @sentry/deno
, @sentry/nextjs
server-side, etc.). Via the newly introduced
APIs, you can now flush metrics directly to Sentry.
To enable capturing metrics, you first need to add the metricsAggregator
experiment to your Sentry.init
call.
Sentry.init({
dsn: '__DSN__',
_experiments: {
metricsAggregator: true,
},
});
Then you'll be able to add counters
, sets
, distributions
, and gauges
under the Sentry.metrics
namespace.
// Add 4 to a counter named `hits`
Sentry.metrics.increment('hits', 4);
// Add 2 to gauge named `parallel_requests`, tagged with `type: "a"`
Sentry.metrics.gauge('parallel_requests', 2, { tags: { type: 'a' } });
// Add 4.6 to a distribution named `response_time` with unit seconds
Sentry.metrics.distribution('response_time', 4.6, { unit: 'seconds' });
// Add 2 to a set named `valuable.ids`
Sentry.metrics.set('valuable.ids', 2);
The ANR tracking integration for Node
has been reworked to use an integration. ANR tracking now requires a minimum Node version of 16 or higher. Previously
you had to call Sentry.enableANRDetection
before running your application, now you can simply add the Anr
integration to your Sentry.init
call.
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })],
});
getGlobalScope()
method (#9920)getIsolationScope()
method (#9957)span.end()
to replace span.finish()
(#9954)startSpan
& startSpanManual
fork scope (#9955)startSpan
, startSpanManual
, trace
(#9958)Changelog
7.90.0
types
field to package.json exports
(#9926)Changelog
7.89.0
configureScope
(#9887)pushScope
& popScope
(#9890)This release deprecates configureScope
, pushScope
, and popScope
, which will be removed in the upcoming v8 major
release.
This release adds an integration for Hapi. It can be used as follows:
const Sentry = require('@sentry/node');
const Hapi = require('@hapi/hapi');
const init = async () => {
const server = Hapi.server({
// your server configuration ...
});
Sentry.init({
dsn: '__DSN__',
tracesSampleRate: 1.0,
integrations: [new Sentry.Integrations.Hapi({ server })],
});
server.route({
// your route configuration ...
});
await server.start();
};
This release adds support for SvelteKit 2.0 in the @sentry/sveltekit
package. If you're upgrading from SvelteKit 1.x
to 2.x and already use the Sentry SvelteKit SDK, no changes apart from upgrading to this (or a newer) version are
necessary.
withScope
to return callback return value (#9866)Deno.CronSchedule
for cron jobs (#9880)canvas.type
setting (#9877)createReduxEnhancer
(#9854)Event
type in worldwide (#9864)eventFromUnknownInput
to avoid scope pollution & getCurrentHub
(#9868)addBreadcrumb
directly & allow to pass hint (#9867)Work in this release contributed by @adam187, and @jghinestrosa. Thank you for your contributions!
Changelog
7.88.0
The release adds alpha support for Sentry developer metrics in
the Browser SDKs (@sentry/browser
and related framework SDKs). Via the newly introduced APIs, you can now flush
metrics directly to Sentry.
To enable capturing metrics, you first need to add the MetricsAggregator
integration.
Sentry.init({
dsn: '__DSN__',
integrations: [new Sentry.metrics.MetricsAggregator()],
});
Then you'll be able to add counters
, sets
, distributions
, and gauges
under the Sentry.metrics
namespace.
// Add 4 to a counter named `hits`
Sentry.metrics.increment('hits', 4);
// Add 2 to gauge named `parallel_requests`, tagged with `happy: "no"`
Sentry.metrics.gauge('parallel_requests', 2, { tags: { happy: 'no' } });
// Add 4.6 to a distribution named `response_time` with unit seconds
Sentry.metrics.distribution('response_time', 4.6, { unit: 'seconds' });
// Add 2 to a set named `valuable.ids`
Sentry.metrics.set('valuable.ids', 2);
In a future release we'll add support for server runtimes (Node, Deno, Bun, Vercel Edge, etc.)
Deno.cron
(#9808)This releases add support for instrumenting Deno cron's with
Sentry cron monitors. This requires v1.38 of Deno run with the --unstable
flag and the usage of the DenoCron
Sentry integration.
// Import from the Deno registry
import * as Sentry from 'https://deno.land/x/sentry/index.mjs';
Sentry.init({
dsn: '__DSN__',
integrations: [new Sentry.DenoCron()],
});
rrweb
to 2.6.0 (#9847)Changelog
7.87.0
getCurrentScope()
method (#9800)rrweb
to 2.5.0 (#9803)./exports
(#9775)assetPrefix
is defined (#9766)Changelog
7.86.0
process.env.NODE_ENV
access in Spotlight integration (#9748)Changelog
7.85.0
addEventProcessor
method (#9554)box-shadow
to use CSS var (#9630)Changelog
7.84.0
automaticVercelMonitors
to be false
by default (#9697)From this version onwards the default for the automaticVercelMonitors
option in the Next.js SDK is set to false.
Previously, if you made use of Vercel Crons the SDK automatically instrumented the relevant routes to create Sentry
monitors. Because this feature will soon be generally available, we are now flipping the default to avoid situations
where quota is used unexpectedly.
If you want to continue using this feature, make sure to set the automaticVercelMonitors
flag to true
in your
next.config.js
Sentry settings.
astro
peer dependency range (#9696)middleware
in node_modules (#9686)