Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,9 +8,9 @@ npx @sentry/migr8@latest

This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!

## Deprecate `startTransaction()`
## Deprecate `startTransaction()` & `span.startChild()`

In v8, the old performance API `startTransaction()` (as well as `hub.startTransaction()`) will be removed.
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
Instead, use the new performance APIs:

* `startSpan()`
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentHub().getScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ app.get('/test-transaction', async function (req, res) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ Sentry.init({

// eslint-disable-next-line deprecation/deprecation
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
// eslint-disable-next-line deprecation/deprecation
const span_1 = transaction.startChild({
op: 'span_1',
data: {
Expand All@@ -23,16 +24,20 @@ for (let i = 0; i < 2000; i++);
span_1.end();

// span_2 doesn't finish
// eslint-disable-next-line deprecation/deprecation
transaction.startChild({ op: 'span_2' });
for (let i = 0; i < 4000; i++);

// eslint-disable-next-line deprecation/deprecation
const span_3 = transaction.startChild({ op: 'span_3' });
for (let i = 0; i < 4000; i++);

// span_4 is the child of span_3 but doesn't finish.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });

// span_5 is another child of span_3 but finishes.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_5' }).end();

// span_3 also finishes
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/src/tracing.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
this._routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
op: ANGULAR_ROUTING_OP,
Expand DownExpand Up@@ -183,6 +184,7 @@ export class TraceDirective implements OnInit, AfterViewInit {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._tracingSpan = activeTransaction.startChild({
description: `<${this.componentName}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -225,6 +227,7 @@ export function TraceClassDecorator(): ClassDecorator {
target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
tracingSpan = activeTransaction.startChild({
description: `<${target.name}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -262,6 +265,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
activeTransaction.startChild({
description: `<${target.constructor.name}>`,
endTimestamp: now,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/tracing/span.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,10 @@ export class Span implements SpanInterface {
}

/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,8 @@ export function startInactiveSpan(context: StartSpanOptions): Span | undefined {
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand DownExpand Up@@ -240,7 +241,8 @@ function createChildSpanOrTransaction(
return undefined;
}
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember/addon/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
return result;
}
currentTransaction
// eslint-disable-next-line deprecation/deprecation
.startChild({
op,
description,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,7 @@ export function _instrumentEmberRouter(
'routing.instrumentation': '@sentry/ember',
},
});
// eslint-disable-next-line deprecation/deprecation
transitionSpan = activeTransaction?.startChild({
op: 'ui.ember.transition',
description: `route:${fromRoute} -> route:${toRoute}`,
Expand DownExpand Up@@ -212,6 +213,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
activeTransaction
// eslint-disable-next-line deprecation/deprecation
?.startChild({
op: `ui.ember.runloop.${queue}`,
origin: 'auto.ui.ember',
Expand DownExpand Up@@ -287,7 +289,7 @@ function processComponentRenderAfter(

if (componentRenderDuration * 1000 >= minComponentDuration) {
const activeTransaction = getActiveTransaction();

// eslint-disable-next-line deprecation/deprecation
activeTransaction?.startChild({
op,
description: payload.containerKey || payload.object,
Expand DownExpand Up@@ -373,6 +375,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
const endTimestamp = startTimestamp + measure.duration / 1000;

const transaction = getActiveTransaction();
// eslint-disable-next-line deprecation/deprecation
const span = transaction?.startChild({
op: 'ui.ember.init',
origin: 'auto.ui.ember',
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -186,6 +186,7 @@ export function pagesRouterInstrumentation(
// We don't want to finish the navigation transaction on `routeChangeComplete`, since users might want to attach
// spans to that transaction even after `routeChangeComplete` is fired (eg. HTTP requests in some useEffect
// hooks). Instead, we'll simply let the navigation transaction finish itself (it's an `IdleTransaction`).
// eslint-disable-next-line deprecation/deprecation
const nextRouteChangeSpan = navigationTransaction.startChild({
op: 'ui.nextjs.route-change',
origin: 'auto.ui.nextjs.pages_router_instrumentation',
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/utils/wrapperUtils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,6 +131,7 @@ export function withTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
spanToContinue = previousSpan;
}

// eslint-disable-next-line deprecation/deprecation
dataFetcherSpan = spanToContinue.startChild({
op: 'function.nextjs',
description: `${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`,
Expand DownExpand Up@@ -209,6 +210,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis

// Capture the route, since pre-loading, revalidation, etc might mean that this span may happen during another
// route's transaction
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
op: 'function.nextjs',
origin: 'auto.function.nextjs',
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,8 @@ function _createWrappedRequestMethodFactory(
const data = getRequestSpanData(requestUrl, requestOptions);

const requestSpan = shouldCreateSpan(rawRequestUrl)
? parentSpan?.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.http',
description: `${data['http.method']} ${data.url}`,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/integrations/undici/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,6 +310,7 @@ function createRequestSpan(
if (url.hash) {
data['http.fragment'] = url.hash;
}
// eslint-disable-next-line deprecation/deprecation
return activeSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.undici',
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/handlers.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -424,6 +424,7 @@ describe('tracingHandler', () => {
it('waits to finish transaction until all spans are finished, even though `transaction.end()` is registered on `res.finish` event first', done => {
const transaction = new Transaction({ name: 'mockTransaction', sampled: true });
transaction.initSpanRecorder();
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: 'reallyCoolHandler',
op: 'middleware',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/src/spanprocessor.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
const sentryParentSpan = otelParentSpanId && getSentrySpan(otelParentSpanId);

if (sentryParentSpan) {
// eslint-disable-next-line deprecation/deprecation
const sentryChildSpan = sentryParentSpan.startChild({
description: otelSpan.name,
instrumenter: 'otel',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/test/propagator.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,7 @@ describe('SentryPropagator', () => {
if (type === PerfType.Span) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { spanId, ...ctx } = transactionContext;
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({ ...ctx, description: transaction.name });
setSentrySpan(span.spanId, span);
}
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/spanExporter.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry
const { op, description, tags, data, origin } = getSpanData(span);
const allData = { ...removeSentryAttributes(attributes), ...data };

// eslint-disable-next-line deprecation/deprecation
const sentrySpan = sentryParentSpan.startChild({
description,
op,
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/profiler.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ class Profiler extends React.Component<ProfilerProps> {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._mountSpan = activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -85,6 +86,7 @@ class Profiler extends React.Component<ProfilerProps> {
const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
if (changedProps.length > 0) {
const now = timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this._updateSpan = this._mountSpan.startChild({
data: {
changedProps,
Expand DownExpand Up@@ -116,6 +118,7 @@ class Profiler extends React.Component<ProfilerProps> {
if (this._mountSpan && includeRender) {
// If we were able to obtain the spanId of the mount activity, we should set the
// next activity as a child to the component mount activity.
// eslint-disable-next-line deprecation/deprecation
this._mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand DownExpand Up@@ -183,6 +186,7 @@ function useProfiler(

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
return activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -201,6 +205,7 @@ function useProfiler(

return (): void => {
if (mountSpan && options.hasRenderSpan) {
// eslint-disable-next-line deprecation/deprecation
mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,7 @@ function makeWrappedDocumentRequestFunction(remixVersion?: number) {
const activeTransaction = getActiveTransaction();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: 'function.remix.document_request',
origin: 'auto.function.remix',
Expand DownExpand Up@@ -239,6 +240,7 @@ function makeWrappedDataFunction(
const currentScope = getCurrentScope();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: `function.remix.${name}`,
origin: 'auto.ui.remix',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/awsservices.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
const req = orig.call(this, operation, params);
req.on('afterBuild', () => {
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: describe(this, operation, params),
op: 'http.client',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-grpc.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
const scope = getCurrentScope();
const transaction = scope.getTransaction();
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `grpc.${serviceIdentifier}`,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const transaction = scope.getTransaction();
if (transaction) {
const httpMethod = reqOpts.method || 'GET';
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/performance.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export function trackComponent(options?: TrackComponentOptions): void {
}

function recordInitSpan(transaction: Transaction, componentName: string): Span {
// eslint-disable-next-line deprecation/deprecation
const initSpan = transaction.startChild({
op: UI_SVELTE_INIT,
description: componentName,
Expand DownExpand Up@@ -75,6 +76,7 @@ function recordUpdateSpans(componentName: string, initSpan?: Span): void {
const parentSpan =
initSpan && !initSpan.endTimestamp && initSpan.transaction === transaction ? initSpan : transaction;

// eslint-disable-next-line deprecation/deprecation
updateSpan = parentSpan.startChild({
op: UI_SVELTE_UPDATE,
description: componentName,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/client/router.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ function instrumentNavigations(startTransactionFn: (context: TransactionContext)
// If a routing span is still open from a previous navigation, we finish it.
routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
routingSpan = activeTransaction.startChild({
op: 'ui.sveltekit.routing',
description: 'SvelteKit Route Change',
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/test/client/router.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand DownExpand Up@@ -168,6 +169,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand Down
2 changes: 2 additions & 0 deletions packages/tracing-internal/src/browser/metrics/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@ export function startTrackingLongTasks(): void {
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
const duration = msToSec(entry.duration);

// eslint-disable-next-line deprecation/deprecation
transaction.startChild({
description: 'Main UI thread blocked',
op: 'ui.long-task',
Expand DownExpand Up@@ -115,6 +116,7 @@ export function startTrackingInteractions(): void {
span.data = { 'ui.component_name': componentName };
}

// eslint-disable-next-line deprecation/deprecation
transaction.startChild(span);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/metrics/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
transaction.startTimestamp = startTimestamp;
}

// eslint-disable-next-line deprecation/deprecation
return transaction.startChild({
startTimestamp,
...ctx,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,8 @@ export function xhrCallback(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
type: 'xhr',
'http.method': sentryXhrData.method,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,8 @@ export function instrumentFetchRequest(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
url,
type: 'fetch',
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,9 +8,9 @@ npx @sentry/migr8@latest

This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!

## Deprecate `startTransaction()`
## Deprecate `startTransaction()` & `span.startChild()`

In v8, the old performance API `startTransaction()` (as well as `hub.startTransaction()`) will be removed.
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
Instead, use the new performance APIs:

* `startSpan()`
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentHub().getScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ app.get('/test-transaction', async function (req, res) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ Sentry.init({

// eslint-disable-next-line deprecation/deprecation
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
// eslint-disable-next-line deprecation/deprecation
const span_1 = transaction.startChild({
op: 'span_1',
data: {
Expand All@@ -23,16 +24,20 @@ for (let i = 0; i < 2000; i++);
span_1.end();

// span_2 doesn't finish
// eslint-disable-next-line deprecation/deprecation
transaction.startChild({ op: 'span_2' });
for (let i = 0; i < 4000; i++);

// eslint-disable-next-line deprecation/deprecation
const span_3 = transaction.startChild({ op: 'span_3' });
for (let i = 0; i < 4000; i++);

// span_4 is the child of span_3 but doesn't finish.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });

// span_5 is another child of span_3 but finishes.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_5' }).end();

// span_3 also finishes
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/src/tracing.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
this._routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
op: ANGULAR_ROUTING_OP,
Expand DownExpand Up@@ -183,6 +184,7 @@ export class TraceDirective implements OnInit, AfterViewInit {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._tracingSpan = activeTransaction.startChild({
description: `<${this.componentName}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -225,6 +227,7 @@ export function TraceClassDecorator(): ClassDecorator {
target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
tracingSpan = activeTransaction.startChild({
description: `<${target.name}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -262,6 +265,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
activeTransaction.startChild({
description: `<${target.constructor.name}>`,
endTimestamp: now,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/tracing/span.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,10 @@ export class Span implements SpanInterface {
}

/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,8 @@ export function startInactiveSpan(context: StartSpanOptions): Span | undefined {
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand DownExpand Up@@ -240,7 +241,8 @@ function createChildSpanOrTransaction(
return undefined;
}
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember/addon/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
return result;
}
currentTransaction
// eslint-disable-next-line deprecation/deprecation
.startChild({
op,
description,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,7 @@ export function _instrumentEmberRouter(
'routing.instrumentation': '@sentry/ember',
},
});
// eslint-disable-next-line deprecation/deprecation
transitionSpan = activeTransaction?.startChild({
op: 'ui.ember.transition',
description: `route:${fromRoute} -> route:${toRoute}`,
Expand DownExpand Up@@ -212,6 +213,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
activeTransaction
// eslint-disable-next-line deprecation/deprecation
?.startChild({
op: `ui.ember.runloop.${queue}`,
origin: 'auto.ui.ember',
Expand DownExpand Up@@ -287,7 +289,7 @@ function processComponentRenderAfter(

if (componentRenderDuration * 1000 >= minComponentDuration) {
const activeTransaction = getActiveTransaction();

// eslint-disable-next-line deprecation/deprecation
activeTransaction?.startChild({
op,
description: payload.containerKey || payload.object,
Expand DownExpand Up@@ -373,6 +375,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
const endTimestamp = startTimestamp + measure.duration / 1000;

const transaction = getActiveTransaction();
// eslint-disable-next-line deprecation/deprecation
const span = transaction?.startChild({
op: 'ui.ember.init',
origin: 'auto.ui.ember',
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -186,6 +186,7 @@ export function pagesRouterInstrumentation(
// We don't want to finish the navigation transaction on `routeChangeComplete`, since users might want to attach
// spans to that transaction even after `routeChangeComplete` is fired (eg. HTTP requests in some useEffect
// hooks). Instead, we'll simply let the navigation transaction finish itself (it's an `IdleTransaction`).
// eslint-disable-next-line deprecation/deprecation
const nextRouteChangeSpan = navigationTransaction.startChild({
op: 'ui.nextjs.route-change',
origin: 'auto.ui.nextjs.pages_router_instrumentation',
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/utils/wrapperUtils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,6 +131,7 @@ export function withTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
spanToContinue = previousSpan;
}

// eslint-disable-next-line deprecation/deprecation
dataFetcherSpan = spanToContinue.startChild({
op: 'function.nextjs',
description: `${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`,
Expand DownExpand Up@@ -209,6 +210,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis

// Capture the route, since pre-loading, revalidation, etc might mean that this span may happen during another
// route's transaction
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
op: 'function.nextjs',
origin: 'auto.function.nextjs',
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,8 @@ function _createWrappedRequestMethodFactory(
const data = getRequestSpanData(requestUrl, requestOptions);

const requestSpan = shouldCreateSpan(rawRequestUrl)
? parentSpan?.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.http',
description: `${data['http.method']} ${data.url}`,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/integrations/undici/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,6 +310,7 @@ function createRequestSpan(
if (url.hash) {
data['http.fragment'] = url.hash;
}
// eslint-disable-next-line deprecation/deprecation
return activeSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.undici',
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/handlers.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -424,6 +424,7 @@ describe('tracingHandler', () => {
it('waits to finish transaction until all spans are finished, even though `transaction.end()` is registered on `res.finish` event first', done => {
const transaction = new Transaction({ name: 'mockTransaction', sampled: true });
transaction.initSpanRecorder();
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: 'reallyCoolHandler',
op: 'middleware',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/src/spanprocessor.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
const sentryParentSpan = otelParentSpanId && getSentrySpan(otelParentSpanId);

if (sentryParentSpan) {
// eslint-disable-next-line deprecation/deprecation
const sentryChildSpan = sentryParentSpan.startChild({
description: otelSpan.name,
instrumenter: 'otel',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/test/propagator.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,7 @@ describe('SentryPropagator', () => {
if (type === PerfType.Span) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { spanId, ...ctx } = transactionContext;
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({ ...ctx, description: transaction.name });
setSentrySpan(span.spanId, span);
}
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/spanExporter.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry
const { op, description, tags, data, origin } = getSpanData(span);
const allData = { ...removeSentryAttributes(attributes), ...data };

// eslint-disable-next-line deprecation/deprecation
const sentrySpan = sentryParentSpan.startChild({
description,
op,
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/profiler.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ class Profiler extends React.Component<ProfilerProps> {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._mountSpan = activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -85,6 +86,7 @@ class Profiler extends React.Component<ProfilerProps> {
const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
if (changedProps.length > 0) {
const now = timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this._updateSpan = this._mountSpan.startChild({
data: {
changedProps,
Expand DownExpand Up@@ -116,6 +118,7 @@ class Profiler extends React.Component<ProfilerProps> {
if (this._mountSpan && includeRender) {
// If we were able to obtain the spanId of the mount activity, we should set the
// next activity as a child to the component mount activity.
// eslint-disable-next-line deprecation/deprecation
this._mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand DownExpand Up@@ -183,6 +186,7 @@ function useProfiler(

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
return activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -201,6 +205,7 @@ function useProfiler(

return (): void => {
if (mountSpan && options.hasRenderSpan) {
// eslint-disable-next-line deprecation/deprecation
mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,7 @@ function makeWrappedDocumentRequestFunction(remixVersion?: number) {
const activeTransaction = getActiveTransaction();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: 'function.remix.document_request',
origin: 'auto.function.remix',
Expand DownExpand Up@@ -239,6 +240,7 @@ function makeWrappedDataFunction(
const currentScope = getCurrentScope();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: `function.remix.${name}`,
origin: 'auto.ui.remix',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/awsservices.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
const req = orig.call(this, operation, params);
req.on('afterBuild', () => {
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: describe(this, operation, params),
op: 'http.client',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-grpc.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
const scope = getCurrentScope();
const transaction = scope.getTransaction();
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `grpc.${serviceIdentifier}`,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const transaction = scope.getTransaction();
if (transaction) {
const httpMethod = reqOpts.method || 'GET';
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/performance.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export function trackComponent(options?: TrackComponentOptions): void {
}

function recordInitSpan(transaction: Transaction, componentName: string): Span {
// eslint-disable-next-line deprecation/deprecation
const initSpan = transaction.startChild({
op: UI_SVELTE_INIT,
description: componentName,
Expand DownExpand Up@@ -75,6 +76,7 @@ function recordUpdateSpans(componentName: string, initSpan?: Span): void {
const parentSpan =
initSpan && !initSpan.endTimestamp && initSpan.transaction === transaction ? initSpan : transaction;

// eslint-disable-next-line deprecation/deprecation
updateSpan = parentSpan.startChild({
op: UI_SVELTE_UPDATE,
description: componentName,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/client/router.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ function instrumentNavigations(startTransactionFn: (context: TransactionContext)
// If a routing span is still open from a previous navigation, we finish it.
routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
routingSpan = activeTransaction.startChild({
op: 'ui.sveltekit.routing',
description: 'SvelteKit Route Change',
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/test/client/router.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand DownExpand Up@@ -168,6 +169,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand Down
2 changes: 2 additions & 0 deletions packages/tracing-internal/src/browser/metrics/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@ export function startTrackingLongTasks(): void {
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
const duration = msToSec(entry.duration);

// eslint-disable-next-line deprecation/deprecation
transaction.startChild({
description: 'Main UI thread blocked',
op: 'ui.long-task',
Expand DownExpand Up@@ -115,6 +116,7 @@ export function startTrackingInteractions(): void {
span.data = { 'ui.component_name': componentName };
}

// eslint-disable-next-line deprecation/deprecation
transaction.startChild(span);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/metrics/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
transaction.startTimestamp = startTimestamp;
}

// eslint-disable-next-line deprecation/deprecation
return transaction.startChild({
startTimestamp,
...ctx,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,8 @@ export function xhrCallback(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
type: 'xhr',
'http.method': sentryXhrData.method,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,8 @@ export function instrumentFetchRequest(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
url,
type: 'fetch',
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,9 +8,9 @@ npx @sentry/migr8@latest

This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!

## Deprecate `startTransaction()`
## Deprecate `startTransaction()` & `span.startChild()`

In v8, the old performance API `startTransaction()` (as well as `hub.startTransaction()`) will be removed.
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
Instead, use the new performance APIs:

* `startSpan()`
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentHub().getScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ app.get('/test-transaction', async function (req, res) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ Sentry.init({

// eslint-disable-next-line deprecation/deprecation
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
// eslint-disable-next-line deprecation/deprecation
const span_1 = transaction.startChild({
op: 'span_1',
data: {
Expand All@@ -23,16 +24,20 @@ for (let i = 0; i < 2000; i++);
span_1.end();

// span_2 doesn't finish
// eslint-disable-next-line deprecation/deprecation
transaction.startChild({ op: 'span_2' });
for (let i = 0; i < 4000; i++);

// eslint-disable-next-line deprecation/deprecation
const span_3 = transaction.startChild({ op: 'span_3' });
for (let i = 0; i < 4000; i++);

// span_4 is the child of span_3 but doesn't finish.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });

// span_5 is another child of span_3 but finishes.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_5' }).end();

// span_3 also finishes
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/src/tracing.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
this._routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
op: ANGULAR_ROUTING_OP,
Expand DownExpand Up@@ -183,6 +184,7 @@ export class TraceDirective implements OnInit, AfterViewInit {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._tracingSpan = activeTransaction.startChild({
description: `<${this.componentName}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -225,6 +227,7 @@ export function TraceClassDecorator(): ClassDecorator {
target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
tracingSpan = activeTransaction.startChild({
description: `<${target.name}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -262,6 +265,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
activeTransaction.startChild({
description: `<${target.constructor.name}>`,
endTimestamp: now,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/tracing/span.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,10 @@ export class Span implements SpanInterface {
}

/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,8 @@ export function startInactiveSpan(context: StartSpanOptions): Span | undefined {
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand DownExpand Up@@ -240,7 +241,8 @@ function createChildSpanOrTransaction(
return undefined;
}
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember/addon/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
return result;
}
currentTransaction
// eslint-disable-next-line deprecation/deprecation
.startChild({
op,
description,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,7 @@ export function _instrumentEmberRouter(
'routing.instrumentation': '@sentry/ember',
},
});
// eslint-disable-next-line deprecation/deprecation
transitionSpan = activeTransaction?.startChild({
op: 'ui.ember.transition',
description: `route:${fromRoute} -> route:${toRoute}`,
Expand DownExpand Up@@ -212,6 +213,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
activeTransaction
// eslint-disable-next-line deprecation/deprecation
?.startChild({
op: `ui.ember.runloop.${queue}`,
origin: 'auto.ui.ember',
Expand DownExpand Up@@ -287,7 +289,7 @@ function processComponentRenderAfter(

if (componentRenderDuration * 1000 >= minComponentDuration) {
const activeTransaction = getActiveTransaction();

// eslint-disable-next-line deprecation/deprecation
activeTransaction?.startChild({
op,
description: payload.containerKey || payload.object,
Expand DownExpand Up@@ -373,6 +375,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
const endTimestamp = startTimestamp + measure.duration / 1000;

const transaction = getActiveTransaction();
// eslint-disable-next-line deprecation/deprecation
const span = transaction?.startChild({
op: 'ui.ember.init',
origin: 'auto.ui.ember',
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -186,6 +186,7 @@ export function pagesRouterInstrumentation(
// We don't want to finish the navigation transaction on `routeChangeComplete`, since users might want to attach
// spans to that transaction even after `routeChangeComplete` is fired (eg. HTTP requests in some useEffect
// hooks). Instead, we'll simply let the navigation transaction finish itself (it's an `IdleTransaction`).
// eslint-disable-next-line deprecation/deprecation
const nextRouteChangeSpan = navigationTransaction.startChild({
op: 'ui.nextjs.route-change',
origin: 'auto.ui.nextjs.pages_router_instrumentation',
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/utils/wrapperUtils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,6 +131,7 @@ export function withTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
spanToContinue = previousSpan;
}

// eslint-disable-next-line deprecation/deprecation
dataFetcherSpan = spanToContinue.startChild({
op: 'function.nextjs',
description: `${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`,
Expand DownExpand Up@@ -209,6 +210,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis

// Capture the route, since pre-loading, revalidation, etc might mean that this span may happen during another
// route's transaction
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
op: 'function.nextjs',
origin: 'auto.function.nextjs',
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,8 @@ function _createWrappedRequestMethodFactory(
const data = getRequestSpanData(requestUrl, requestOptions);

const requestSpan = shouldCreateSpan(rawRequestUrl)
? parentSpan?.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.http',
description: `${data['http.method']} ${data.url}`,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/integrations/undici/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,6 +310,7 @@ function createRequestSpan(
if (url.hash) {
data['http.fragment'] = url.hash;
}
// eslint-disable-next-line deprecation/deprecation
return activeSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.undici',
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/handlers.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -424,6 +424,7 @@ describe('tracingHandler', () => {
it('waits to finish transaction until all spans are finished, even though `transaction.end()` is registered on `res.finish` event first', done => {
const transaction = new Transaction({ name: 'mockTransaction', sampled: true });
transaction.initSpanRecorder();
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: 'reallyCoolHandler',
op: 'middleware',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/src/spanprocessor.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
const sentryParentSpan = otelParentSpanId && getSentrySpan(otelParentSpanId);

if (sentryParentSpan) {
// eslint-disable-next-line deprecation/deprecation
const sentryChildSpan = sentryParentSpan.startChild({
description: otelSpan.name,
instrumenter: 'otel',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/test/propagator.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,7 @@ describe('SentryPropagator', () => {
if (type === PerfType.Span) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { spanId, ...ctx } = transactionContext;
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({ ...ctx, description: transaction.name });
setSentrySpan(span.spanId, span);
}
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/spanExporter.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry
const { op, description, tags, data, origin } = getSpanData(span);
const allData = { ...removeSentryAttributes(attributes), ...data };

// eslint-disable-next-line deprecation/deprecation
const sentrySpan = sentryParentSpan.startChild({
description,
op,
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/profiler.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ class Profiler extends React.Component<ProfilerProps> {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._mountSpan = activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -85,6 +86,7 @@ class Profiler extends React.Component<ProfilerProps> {
const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
if (changedProps.length > 0) {
const now = timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this._updateSpan = this._mountSpan.startChild({
data: {
changedProps,
Expand DownExpand Up@@ -116,6 +118,7 @@ class Profiler extends React.Component<ProfilerProps> {
if (this._mountSpan && includeRender) {
// If we were able to obtain the spanId of the mount activity, we should set the
// next activity as a child to the component mount activity.
// eslint-disable-next-line deprecation/deprecation
this._mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand DownExpand Up@@ -183,6 +186,7 @@ function useProfiler(

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
return activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -201,6 +205,7 @@ function useProfiler(

return (): void => {
if (mountSpan && options.hasRenderSpan) {
// eslint-disable-next-line deprecation/deprecation
mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,7 @@ function makeWrappedDocumentRequestFunction(remixVersion?: number) {
const activeTransaction = getActiveTransaction();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: 'function.remix.document_request',
origin: 'auto.function.remix',
Expand DownExpand Up@@ -239,6 +240,7 @@ function makeWrappedDataFunction(
const currentScope = getCurrentScope();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: `function.remix.${name}`,
origin: 'auto.ui.remix',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/awsservices.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
const req = orig.call(this, operation, params);
req.on('afterBuild', () => {
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: describe(this, operation, params),
op: 'http.client',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-grpc.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
const scope = getCurrentScope();
const transaction = scope.getTransaction();
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `grpc.${serviceIdentifier}`,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const transaction = scope.getTransaction();
if (transaction) {
const httpMethod = reqOpts.method || 'GET';
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/performance.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export function trackComponent(options?: TrackComponentOptions): void {
}

function recordInitSpan(transaction: Transaction, componentName: string): Span {
// eslint-disable-next-line deprecation/deprecation
const initSpan = transaction.startChild({
op: UI_SVELTE_INIT,
description: componentName,
Expand DownExpand Up@@ -75,6 +76,7 @@ function recordUpdateSpans(componentName: string, initSpan?: Span): void {
const parentSpan =
initSpan && !initSpan.endTimestamp && initSpan.transaction === transaction ? initSpan : transaction;

// eslint-disable-next-line deprecation/deprecation
updateSpan = parentSpan.startChild({
op: UI_SVELTE_UPDATE,
description: componentName,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/client/router.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ function instrumentNavigations(startTransactionFn: (context: TransactionContext)
// If a routing span is still open from a previous navigation, we finish it.
routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
routingSpan = activeTransaction.startChild({
op: 'ui.sveltekit.routing',
description: 'SvelteKit Route Change',
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/test/client/router.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand DownExpand Up@@ -168,6 +169,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand Down
2 changes: 2 additions & 0 deletions packages/tracing-internal/src/browser/metrics/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@ export function startTrackingLongTasks(): void {
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
const duration = msToSec(entry.duration);

// eslint-disable-next-line deprecation/deprecation
transaction.startChild({
description: 'Main UI thread blocked',
op: 'ui.long-task',
Expand DownExpand Up@@ -115,6 +116,7 @@ export function startTrackingInteractions(): void {
span.data = { 'ui.component_name': componentName };
}

// eslint-disable-next-line deprecation/deprecation
transaction.startChild(span);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/metrics/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
transaction.startTimestamp = startTimestamp;
}

// eslint-disable-next-line deprecation/deprecation
return transaction.startChild({
startTimestamp,
...ctx,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,8 @@ export function xhrCallback(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
type: 'xhr',
'http.method': sentryXhrData.method,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,8 @@ export function instrumentFetchRequest(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
url,
type: 'fetch',
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,9 +8,9 @@ npx @sentry/migr8@latest

This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!

## Deprecate `startTransaction()`
## Deprecate `startTransaction()` & `span.startChild()`

In v8, the old performance API `startTransaction()` (as well as `hub.startTransaction()`) will be removed.
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
Instead, use the new performance APIs:

* `startSpan()`
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentHub().getScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ app.get('/test-transaction', async function (req, res) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ Sentry.init({

// eslint-disable-next-line deprecation/deprecation
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
// eslint-disable-next-line deprecation/deprecation
const span_1 = transaction.startChild({
op: 'span_1',
data: {
Expand All@@ -23,16 +24,20 @@ for (let i = 0; i < 2000; i++);
span_1.end();

// span_2 doesn't finish
// eslint-disable-next-line deprecation/deprecation
transaction.startChild({ op: 'span_2' });
for (let i = 0; i < 4000; i++);

// eslint-disable-next-line deprecation/deprecation
const span_3 = transaction.startChild({ op: 'span_3' });
for (let i = 0; i < 4000; i++);

// span_4 is the child of span_3 but doesn't finish.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });

// span_5 is another child of span_3 but finishes.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_5' }).end();

// span_3 also finishes
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/src/tracing.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
this._routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
op: ANGULAR_ROUTING_OP,
Expand DownExpand Up@@ -183,6 +184,7 @@ export class TraceDirective implements OnInit, AfterViewInit {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._tracingSpan = activeTransaction.startChild({
description: `<${this.componentName}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -225,6 +227,7 @@ export function TraceClassDecorator(): ClassDecorator {
target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
tracingSpan = activeTransaction.startChild({
description: `<${target.name}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -262,6 +265,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
activeTransaction.startChild({
description: `<${target.constructor.name}>`,
endTimestamp: now,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/tracing/span.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,10 @@ export class Span implements SpanInterface {
}

/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,8 @@ export function startInactiveSpan(context: StartSpanOptions): Span | undefined {
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand DownExpand Up@@ -240,7 +241,8 @@ function createChildSpanOrTransaction(
return undefined;
}
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember/addon/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
return result;
}
currentTransaction
// eslint-disable-next-line deprecation/deprecation
.startChild({
op,
description,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,7 @@ export function _instrumentEmberRouter(
'routing.instrumentation': '@sentry/ember',
},
});
// eslint-disable-next-line deprecation/deprecation
transitionSpan = activeTransaction?.startChild({
op: 'ui.ember.transition',
description: `route:${fromRoute} -> route:${toRoute}`,
Expand DownExpand Up@@ -212,6 +213,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
activeTransaction
// eslint-disable-next-line deprecation/deprecation
?.startChild({
op: `ui.ember.runloop.${queue}`,
origin: 'auto.ui.ember',
Expand DownExpand Up@@ -287,7 +289,7 @@ function processComponentRenderAfter(

if (componentRenderDuration * 1000 >= minComponentDuration) {
const activeTransaction = getActiveTransaction();

// eslint-disable-next-line deprecation/deprecation
activeTransaction?.startChild({
op,
description: payload.containerKey || payload.object,
Expand DownExpand Up@@ -373,6 +375,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
const endTimestamp = startTimestamp + measure.duration / 1000;

const transaction = getActiveTransaction();
// eslint-disable-next-line deprecation/deprecation
const span = transaction?.startChild({
op: 'ui.ember.init',
origin: 'auto.ui.ember',
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -186,6 +186,7 @@ export function pagesRouterInstrumentation(
// We don't want to finish the navigation transaction on `routeChangeComplete`, since users might want to attach
// spans to that transaction even after `routeChangeComplete` is fired (eg. HTTP requests in some useEffect
// hooks). Instead, we'll simply let the navigation transaction finish itself (it's an `IdleTransaction`).
// eslint-disable-next-line deprecation/deprecation
const nextRouteChangeSpan = navigationTransaction.startChild({
op: 'ui.nextjs.route-change',
origin: 'auto.ui.nextjs.pages_router_instrumentation',
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/utils/wrapperUtils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,6 +131,7 @@ export function withTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
spanToContinue = previousSpan;
}

// eslint-disable-next-line deprecation/deprecation
dataFetcherSpan = spanToContinue.startChild({
op: 'function.nextjs',
description: `${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`,
Expand DownExpand Up@@ -209,6 +210,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis

// Capture the route, since pre-loading, revalidation, etc might mean that this span may happen during another
// route's transaction
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
op: 'function.nextjs',
origin: 'auto.function.nextjs',
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,8 @@ function _createWrappedRequestMethodFactory(
const data = getRequestSpanData(requestUrl, requestOptions);

const requestSpan = shouldCreateSpan(rawRequestUrl)
? parentSpan?.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.http',
description: `${data['http.method']} ${data.url}`,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/integrations/undici/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,6 +310,7 @@ function createRequestSpan(
if (url.hash) {
data['http.fragment'] = url.hash;
}
// eslint-disable-next-line deprecation/deprecation
return activeSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.undici',
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/handlers.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -424,6 +424,7 @@ describe('tracingHandler', () => {
it('waits to finish transaction until all spans are finished, even though `transaction.end()` is registered on `res.finish` event first', done => {
const transaction = new Transaction({ name: 'mockTransaction', sampled: true });
transaction.initSpanRecorder();
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: 'reallyCoolHandler',
op: 'middleware',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/src/spanprocessor.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
const sentryParentSpan = otelParentSpanId && getSentrySpan(otelParentSpanId);

if (sentryParentSpan) {
// eslint-disable-next-line deprecation/deprecation
const sentryChildSpan = sentryParentSpan.startChild({
description: otelSpan.name,
instrumenter: 'otel',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/test/propagator.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,7 @@ describe('SentryPropagator', () => {
if (type === PerfType.Span) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { spanId, ...ctx } = transactionContext;
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({ ...ctx, description: transaction.name });
setSentrySpan(span.spanId, span);
}
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/spanExporter.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry
const { op, description, tags, data, origin } = getSpanData(span);
const allData = { ...removeSentryAttributes(attributes), ...data };

// eslint-disable-next-line deprecation/deprecation
const sentrySpan = sentryParentSpan.startChild({
description,
op,
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/profiler.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ class Profiler extends React.Component<ProfilerProps> {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._mountSpan = activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -85,6 +86,7 @@ class Profiler extends React.Component<ProfilerProps> {
const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
if (changedProps.length > 0) {
const now = timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this._updateSpan = this._mountSpan.startChild({
data: {
changedProps,
Expand DownExpand Up@@ -116,6 +118,7 @@ class Profiler extends React.Component<ProfilerProps> {
if (this._mountSpan && includeRender) {
// If we were able to obtain the spanId of the mount activity, we should set the
// next activity as a child to the component mount activity.
// eslint-disable-next-line deprecation/deprecation
this._mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand DownExpand Up@@ -183,6 +186,7 @@ function useProfiler(

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
return activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -201,6 +205,7 @@ function useProfiler(

return (): void => {
if (mountSpan && options.hasRenderSpan) {
// eslint-disable-next-line deprecation/deprecation
mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,7 @@ function makeWrappedDocumentRequestFunction(remixVersion?: number) {
const activeTransaction = getActiveTransaction();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: 'function.remix.document_request',
origin: 'auto.function.remix',
Expand DownExpand Up@@ -239,6 +240,7 @@ function makeWrappedDataFunction(
const currentScope = getCurrentScope();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: `function.remix.${name}`,
origin: 'auto.ui.remix',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/awsservices.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
const req = orig.call(this, operation, params);
req.on('afterBuild', () => {
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: describe(this, operation, params),
op: 'http.client',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-grpc.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
const scope = getCurrentScope();
const transaction = scope.getTransaction();
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `grpc.${serviceIdentifier}`,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const transaction = scope.getTransaction();
if (transaction) {
const httpMethod = reqOpts.method || 'GET';
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/performance.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export function trackComponent(options?: TrackComponentOptions): void {
}

function recordInitSpan(transaction: Transaction, componentName: string): Span {
// eslint-disable-next-line deprecation/deprecation
const initSpan = transaction.startChild({
op: UI_SVELTE_INIT,
description: componentName,
Expand DownExpand Up@@ -75,6 +76,7 @@ function recordUpdateSpans(componentName: string, initSpan?: Span): void {
const parentSpan =
initSpan && !initSpan.endTimestamp && initSpan.transaction === transaction ? initSpan : transaction;

// eslint-disable-next-line deprecation/deprecation
updateSpan = parentSpan.startChild({
op: UI_SVELTE_UPDATE,
description: componentName,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/client/router.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ function instrumentNavigations(startTransactionFn: (context: TransactionContext)
// If a routing span is still open from a previous navigation, we finish it.
routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
routingSpan = activeTransaction.startChild({
op: 'ui.sveltekit.routing',
description: 'SvelteKit Route Change',
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/test/client/router.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand DownExpand Up@@ -168,6 +169,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand Down
2 changes: 2 additions & 0 deletions packages/tracing-internal/src/browser/metrics/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@ export function startTrackingLongTasks(): void {
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
const duration = msToSec(entry.duration);

// eslint-disable-next-line deprecation/deprecation
transaction.startChild({
description: 'Main UI thread blocked',
op: 'ui.long-task',
Expand DownExpand Up@@ -115,6 +116,7 @@ export function startTrackingInteractions(): void {
span.data = { 'ui.component_name': componentName };
}

// eslint-disable-next-line deprecation/deprecation
transaction.startChild(span);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/metrics/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
transaction.startTimestamp = startTimestamp;
}

// eslint-disable-next-line deprecation/deprecation
return transaction.startChild({
startTimestamp,
...ctx,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,8 @@ export function xhrCallback(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
type: 'xhr',
'http.method': sentryXhrData.method,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,8 @@ export function instrumentFetchRequest(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
url,
type: 'fetch',
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,9 +8,9 @@ npx @sentry/migr8@latest

This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!

## Deprecate `startTransaction()`
## Deprecate `startTransaction()` & `span.startChild()`

In v8, the old performance API `startTransaction()` (as well as `hub.startTransaction()`) will be removed.
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
Instead, use the new performance APIs:

* `startSpan()`
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentHub().getScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ app.get('/test-transaction', async function (req, res) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ Sentry.init({

// eslint-disable-next-line deprecation/deprecation
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
// eslint-disable-next-line deprecation/deprecation
const span_1 = transaction.startChild({
op: 'span_1',
data: {
Expand All@@ -23,16 +24,20 @@ for (let i = 0; i < 2000; i++);
span_1.end();

// span_2 doesn't finish
// eslint-disable-next-line deprecation/deprecation
transaction.startChild({ op: 'span_2' });
for (let i = 0; i < 4000; i++);

// eslint-disable-next-line deprecation/deprecation
const span_3 = transaction.startChild({ op: 'span_3' });
for (let i = 0; i < 4000; i++);

// span_4 is the child of span_3 but doesn't finish.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });

// span_5 is another child of span_3 but finishes.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_5' }).end();

// span_3 also finishes
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/src/tracing.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
this._routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
op: ANGULAR_ROUTING_OP,
Expand DownExpand Up@@ -183,6 +184,7 @@ export class TraceDirective implements OnInit, AfterViewInit {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._tracingSpan = activeTransaction.startChild({
description: `<${this.componentName}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -225,6 +227,7 @@ export function TraceClassDecorator(): ClassDecorator {
target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
tracingSpan = activeTransaction.startChild({
description: `<${target.name}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -262,6 +265,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
activeTransaction.startChild({
description: `<${target.constructor.name}>`,
endTimestamp: now,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/tracing/span.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,10 @@ export class Span implements SpanInterface {
}

/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,8 @@ export function startInactiveSpan(context: StartSpanOptions): Span | undefined {
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand DownExpand Up@@ -240,7 +241,8 @@ function createChildSpanOrTransaction(
return undefined;
}
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember/addon/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
return result;
}
currentTransaction
// eslint-disable-next-line deprecation/deprecation
.startChild({
op,
description,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,7 @@ export function _instrumentEmberRouter(
'routing.instrumentation': '@sentry/ember',
},
});
// eslint-disable-next-line deprecation/deprecation
transitionSpan = activeTransaction?.startChild({
op: 'ui.ember.transition',
description: `route:${fromRoute} -> route:${toRoute}`,
Expand DownExpand Up@@ -212,6 +213,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
activeTransaction
// eslint-disable-next-line deprecation/deprecation
?.startChild({
op: `ui.ember.runloop.${queue}`,
origin: 'auto.ui.ember',
Expand DownExpand Up@@ -287,7 +289,7 @@ function processComponentRenderAfter(

if (componentRenderDuration * 1000 >= minComponentDuration) {
const activeTransaction = getActiveTransaction();

// eslint-disable-next-line deprecation/deprecation
activeTransaction?.startChild({
op,
description: payload.containerKey || payload.object,
Expand DownExpand Up@@ -373,6 +375,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
const endTimestamp = startTimestamp + measure.duration / 1000;

const transaction = getActiveTransaction();
// eslint-disable-next-line deprecation/deprecation
const span = transaction?.startChild({
op: 'ui.ember.init',
origin: 'auto.ui.ember',
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -186,6 +186,7 @@ export function pagesRouterInstrumentation(
// We don't want to finish the navigation transaction on `routeChangeComplete`, since users might want to attach
// spans to that transaction even after `routeChangeComplete` is fired (eg. HTTP requests in some useEffect
// hooks). Instead, we'll simply let the navigation transaction finish itself (it's an `IdleTransaction`).
// eslint-disable-next-line deprecation/deprecation
const nextRouteChangeSpan = navigationTransaction.startChild({
op: 'ui.nextjs.route-change',
origin: 'auto.ui.nextjs.pages_router_instrumentation',
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/utils/wrapperUtils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,6 +131,7 @@ export function withTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
spanToContinue = previousSpan;
}

// eslint-disable-next-line deprecation/deprecation
dataFetcherSpan = spanToContinue.startChild({
op: 'function.nextjs',
description: `${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`,
Expand DownExpand Up@@ -209,6 +210,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis

// Capture the route, since pre-loading, revalidation, etc might mean that this span may happen during another
// route's transaction
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
op: 'function.nextjs',
origin: 'auto.function.nextjs',
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,8 @@ function _createWrappedRequestMethodFactory(
const data = getRequestSpanData(requestUrl, requestOptions);

const requestSpan = shouldCreateSpan(rawRequestUrl)
? parentSpan?.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.http',
description: `${data['http.method']} ${data.url}`,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/integrations/undici/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,6 +310,7 @@ function createRequestSpan(
if (url.hash) {
data['http.fragment'] = url.hash;
}
// eslint-disable-next-line deprecation/deprecation
return activeSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.undici',
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/handlers.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -424,6 +424,7 @@ describe('tracingHandler', () => {
it('waits to finish transaction until all spans are finished, even though `transaction.end()` is registered on `res.finish` event first', done => {
const transaction = new Transaction({ name: 'mockTransaction', sampled: true });
transaction.initSpanRecorder();
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: 'reallyCoolHandler',
op: 'middleware',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/src/spanprocessor.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
const sentryParentSpan = otelParentSpanId && getSentrySpan(otelParentSpanId);

if (sentryParentSpan) {
// eslint-disable-next-line deprecation/deprecation
const sentryChildSpan = sentryParentSpan.startChild({
description: otelSpan.name,
instrumenter: 'otel',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/test/propagator.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,7 @@ describe('SentryPropagator', () => {
if (type === PerfType.Span) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { spanId, ...ctx } = transactionContext;
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({ ...ctx, description: transaction.name });
setSentrySpan(span.spanId, span);
}
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/spanExporter.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry
const { op, description, tags, data, origin } = getSpanData(span);
const allData = { ...removeSentryAttributes(attributes), ...data };

// eslint-disable-next-line deprecation/deprecation
const sentrySpan = sentryParentSpan.startChild({
description,
op,
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/profiler.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ class Profiler extends React.Component<ProfilerProps> {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._mountSpan = activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -85,6 +86,7 @@ class Profiler extends React.Component<ProfilerProps> {
const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
if (changedProps.length > 0) {
const now = timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this._updateSpan = this._mountSpan.startChild({
data: {
changedProps,
Expand DownExpand Up@@ -116,6 +118,7 @@ class Profiler extends React.Component<ProfilerProps> {
if (this._mountSpan && includeRender) {
// If we were able to obtain the spanId of the mount activity, we should set the
// next activity as a child to the component mount activity.
// eslint-disable-next-line deprecation/deprecation
this._mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand DownExpand Up@@ -183,6 +186,7 @@ function useProfiler(

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
return activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -201,6 +205,7 @@ function useProfiler(

return (): void => {
if (mountSpan && options.hasRenderSpan) {
// eslint-disable-next-line deprecation/deprecation
mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,7 @@ function makeWrappedDocumentRequestFunction(remixVersion?: number) {
const activeTransaction = getActiveTransaction();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: 'function.remix.document_request',
origin: 'auto.function.remix',
Expand DownExpand Up@@ -239,6 +240,7 @@ function makeWrappedDataFunction(
const currentScope = getCurrentScope();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: `function.remix.${name}`,
origin: 'auto.ui.remix',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/awsservices.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
const req = orig.call(this, operation, params);
req.on('afterBuild', () => {
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: describe(this, operation, params),
op: 'http.client',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-grpc.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
const scope = getCurrentScope();
const transaction = scope.getTransaction();
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `grpc.${serviceIdentifier}`,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const transaction = scope.getTransaction();
if (transaction) {
const httpMethod = reqOpts.method || 'GET';
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/performance.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export function trackComponent(options?: TrackComponentOptions): void {
}

function recordInitSpan(transaction: Transaction, componentName: string): Span {
// eslint-disable-next-line deprecation/deprecation
const initSpan = transaction.startChild({
op: UI_SVELTE_INIT,
description: componentName,
Expand DownExpand Up@@ -75,6 +76,7 @@ function recordUpdateSpans(componentName: string, initSpan?: Span): void {
const parentSpan =
initSpan && !initSpan.endTimestamp && initSpan.transaction === transaction ? initSpan : transaction;

// eslint-disable-next-line deprecation/deprecation
updateSpan = parentSpan.startChild({
op: UI_SVELTE_UPDATE,
description: componentName,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/client/router.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ function instrumentNavigations(startTransactionFn: (context: TransactionContext)
// If a routing span is still open from a previous navigation, we finish it.
routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
routingSpan = activeTransaction.startChild({
op: 'ui.sveltekit.routing',
description: 'SvelteKit Route Change',
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/test/client/router.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand DownExpand Up@@ -168,6 +169,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand Down
2 changes: 2 additions & 0 deletions packages/tracing-internal/src/browser/metrics/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@ export function startTrackingLongTasks(): void {
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
const duration = msToSec(entry.duration);

// eslint-disable-next-line deprecation/deprecation
transaction.startChild({
description: 'Main UI thread blocked',
op: 'ui.long-task',
Expand DownExpand Up@@ -115,6 +116,7 @@ export function startTrackingInteractions(): void {
span.data = { 'ui.component_name': componentName };
}

// eslint-disable-next-line deprecation/deprecation
transaction.startChild(span);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/metrics/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
transaction.startTimestamp = startTimestamp;
}

// eslint-disable-next-line deprecation/deprecation
return transaction.startChild({
startTimestamp,
...ctx,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,8 @@ export function xhrCallback(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
type: 'xhr',
'http.method': sentryXhrData.method,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,8 @@ export function instrumentFetchRequest(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
url,
type: 'fetch',
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,9 +8,9 @@ npx @sentry/migr8@latest

This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!

## Deprecate `startTransaction()`
## Deprecate `startTransaction()` & `span.startChild()`

In v8, the old performance API `startTransaction()` (as well as `hub.startTransaction()`) will be removed.
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
Instead, use the new performance APIs:

* `startSpan()`
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentHub().getScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ app.get('/test-transaction', async function (req, res) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ Sentry.init({

// eslint-disable-next-line deprecation/deprecation
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
// eslint-disable-next-line deprecation/deprecation
const span_1 = transaction.startChild({
op: 'span_1',
data: {
Expand All@@ -23,16 +24,20 @@ for (let i = 0; i < 2000; i++);
span_1.end();

// span_2 doesn't finish
// eslint-disable-next-line deprecation/deprecation
transaction.startChild({ op: 'span_2' });
for (let i = 0; i < 4000; i++);

// eslint-disable-next-line deprecation/deprecation
const span_3 = transaction.startChild({ op: 'span_3' });
for (let i = 0; i < 4000; i++);

// span_4 is the child of span_3 but doesn't finish.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });

// span_5 is another child of span_3 but finishes.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_5' }).end();

// span_3 also finishes
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/src/tracing.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
this._routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
op: ANGULAR_ROUTING_OP,
Expand DownExpand Up@@ -183,6 +184,7 @@ export class TraceDirective implements OnInit, AfterViewInit {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._tracingSpan = activeTransaction.startChild({
description: `<${this.componentName}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -225,6 +227,7 @@ export function TraceClassDecorator(): ClassDecorator {
target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
tracingSpan = activeTransaction.startChild({
description: `<${target.name}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -262,6 +265,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
activeTransaction.startChild({
description: `<${target.constructor.name}>`,
endTimestamp: now,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/tracing/span.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,10 @@ export class Span implements SpanInterface {
}

/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,8 @@ export function startInactiveSpan(context: StartSpanOptions): Span | undefined {
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand DownExpand Up@@ -240,7 +241,8 @@ function createChildSpanOrTransaction(
return undefined;
}
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember/addon/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
return result;
}
currentTransaction
// eslint-disable-next-line deprecation/deprecation
.startChild({
op,
description,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,7 @@ export function _instrumentEmberRouter(
'routing.instrumentation': '@sentry/ember',
},
});
// eslint-disable-next-line deprecation/deprecation
transitionSpan = activeTransaction?.startChild({
op: 'ui.ember.transition',
description: `route:${fromRoute} -> route:${toRoute}`,
Expand DownExpand Up@@ -212,6 +213,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
activeTransaction
// eslint-disable-next-line deprecation/deprecation
?.startChild({
op: `ui.ember.runloop.${queue}`,
origin: 'auto.ui.ember',
Expand DownExpand Up@@ -287,7 +289,7 @@ function processComponentRenderAfter(

if (componentRenderDuration * 1000 >= minComponentDuration) {
const activeTransaction = getActiveTransaction();

// eslint-disable-next-line deprecation/deprecation
activeTransaction?.startChild({
op,
description: payload.containerKey || payload.object,
Expand DownExpand Up@@ -373,6 +375,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
const endTimestamp = startTimestamp + measure.duration / 1000;

const transaction = getActiveTransaction();
// eslint-disable-next-line deprecation/deprecation
const span = transaction?.startChild({
op: 'ui.ember.init',
origin: 'auto.ui.ember',
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -186,6 +186,7 @@ export function pagesRouterInstrumentation(
// We don't want to finish the navigation transaction on `routeChangeComplete`, since users might want to attach
// spans to that transaction even after `routeChangeComplete` is fired (eg. HTTP requests in some useEffect
// hooks). Instead, we'll simply let the navigation transaction finish itself (it's an `IdleTransaction`).
// eslint-disable-next-line deprecation/deprecation
const nextRouteChangeSpan = navigationTransaction.startChild({
op: 'ui.nextjs.route-change',
origin: 'auto.ui.nextjs.pages_router_instrumentation',
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/utils/wrapperUtils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,6 +131,7 @@ export function withTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
spanToContinue = previousSpan;
}

// eslint-disable-next-line deprecation/deprecation
dataFetcherSpan = spanToContinue.startChild({
op: 'function.nextjs',
description: `${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`,
Expand DownExpand Up@@ -209,6 +210,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis

// Capture the route, since pre-loading, revalidation, etc might mean that this span may happen during another
// route's transaction
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
op: 'function.nextjs',
origin: 'auto.function.nextjs',
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,8 @@ function _createWrappedRequestMethodFactory(
const data = getRequestSpanData(requestUrl, requestOptions);

const requestSpan = shouldCreateSpan(rawRequestUrl)
? parentSpan?.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.http',
description: `${data['http.method']} ${data.url}`,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/integrations/undici/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,6 +310,7 @@ function createRequestSpan(
if (url.hash) {
data['http.fragment'] = url.hash;
}
// eslint-disable-next-line deprecation/deprecation
return activeSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.undici',
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/handlers.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -424,6 +424,7 @@ describe('tracingHandler', () => {
it('waits to finish transaction until all spans are finished, even though `transaction.end()` is registered on `res.finish` event first', done => {
const transaction = new Transaction({ name: 'mockTransaction', sampled: true });
transaction.initSpanRecorder();
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: 'reallyCoolHandler',
op: 'middleware',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/src/spanprocessor.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
const sentryParentSpan = otelParentSpanId && getSentrySpan(otelParentSpanId);

if (sentryParentSpan) {
// eslint-disable-next-line deprecation/deprecation
const sentryChildSpan = sentryParentSpan.startChild({
description: otelSpan.name,
instrumenter: 'otel',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/test/propagator.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,7 @@ describe('SentryPropagator', () => {
if (type === PerfType.Span) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { spanId, ...ctx } = transactionContext;
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({ ...ctx, description: transaction.name });
setSentrySpan(span.spanId, span);
}
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/spanExporter.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry
const { op, description, tags, data, origin } = getSpanData(span);
const allData = { ...removeSentryAttributes(attributes), ...data };

// eslint-disable-next-line deprecation/deprecation
const sentrySpan = sentryParentSpan.startChild({
description,
op,
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/profiler.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ class Profiler extends React.Component<ProfilerProps> {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._mountSpan = activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -85,6 +86,7 @@ class Profiler extends React.Component<ProfilerProps> {
const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
if (changedProps.length > 0) {
const now = timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this._updateSpan = this._mountSpan.startChild({
data: {
changedProps,
Expand DownExpand Up@@ -116,6 +118,7 @@ class Profiler extends React.Component<ProfilerProps> {
if (this._mountSpan && includeRender) {
// If we were able to obtain the spanId of the mount activity, we should set the
// next activity as a child to the component mount activity.
// eslint-disable-next-line deprecation/deprecation
this._mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand DownExpand Up@@ -183,6 +186,7 @@ function useProfiler(

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
return activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -201,6 +205,7 @@ function useProfiler(

return (): void => {
if (mountSpan && options.hasRenderSpan) {
// eslint-disable-next-line deprecation/deprecation
mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,7 @@ function makeWrappedDocumentRequestFunction(remixVersion?: number) {
const activeTransaction = getActiveTransaction();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: 'function.remix.document_request',
origin: 'auto.function.remix',
Expand DownExpand Up@@ -239,6 +240,7 @@ function makeWrappedDataFunction(
const currentScope = getCurrentScope();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: `function.remix.${name}`,
origin: 'auto.ui.remix',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/awsservices.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
const req = orig.call(this, operation, params);
req.on('afterBuild', () => {
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: describe(this, operation, params),
op: 'http.client',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-grpc.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
const scope = getCurrentScope();
const transaction = scope.getTransaction();
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `grpc.${serviceIdentifier}`,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const transaction = scope.getTransaction();
if (transaction) {
const httpMethod = reqOpts.method || 'GET';
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/performance.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export function trackComponent(options?: TrackComponentOptions): void {
}

function recordInitSpan(transaction: Transaction, componentName: string): Span {
// eslint-disable-next-line deprecation/deprecation
const initSpan = transaction.startChild({
op: UI_SVELTE_INIT,
description: componentName,
Expand DownExpand Up@@ -75,6 +76,7 @@ function recordUpdateSpans(componentName: string, initSpan?: Span): void {
const parentSpan =
initSpan && !initSpan.endTimestamp && initSpan.transaction === transaction ? initSpan : transaction;

// eslint-disable-next-line deprecation/deprecation
updateSpan = parentSpan.startChild({
op: UI_SVELTE_UPDATE,
description: componentName,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/client/router.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ function instrumentNavigations(startTransactionFn: (context: TransactionContext)
// If a routing span is still open from a previous navigation, we finish it.
routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
routingSpan = activeTransaction.startChild({
op: 'ui.sveltekit.routing',
description: 'SvelteKit Route Change',
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/test/client/router.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand DownExpand Up@@ -168,6 +169,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand Down
2 changes: 2 additions & 0 deletions packages/tracing-internal/src/browser/metrics/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@ export function startTrackingLongTasks(): void {
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
const duration = msToSec(entry.duration);

// eslint-disable-next-line deprecation/deprecation
transaction.startChild({
description: 'Main UI thread blocked',
op: 'ui.long-task',
Expand DownExpand Up@@ -115,6 +116,7 @@ export function startTrackingInteractions(): void {
span.data = { 'ui.component_name': componentName };
}

// eslint-disable-next-line deprecation/deprecation
transaction.startChild(span);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/metrics/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
transaction.startTimestamp = startTimestamp;
}

// eslint-disable-next-line deprecation/deprecation
return transaction.startChild({
startTimestamp,
...ctx,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,8 @@ export function xhrCallback(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
type: 'xhr',
'http.method': sentryXhrData.method,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,8 @@ export function instrumentFetchRequest(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
url,
type: 'fetch',
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,9 +8,9 @@ npx @sentry/migr8@latest

This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!

## Deprecate `startTransaction()`
## Deprecate `startTransaction()` & `span.startChild()`

In v8, the old performance API `startTransaction()` (as well as `hub.startTransaction()`) will be removed.
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
Instead, use the new performance APIs:

* `startSpan()`
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentHub().getScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ app.get('/test-transaction', async function (req, res) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ Sentry.init({

// eslint-disable-next-line deprecation/deprecation
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
// eslint-disable-next-line deprecation/deprecation
const span_1 = transaction.startChild({
op: 'span_1',
data: {
Expand All@@ -23,16 +24,20 @@ for (let i = 0; i < 2000; i++);
span_1.end();

// span_2 doesn't finish
// eslint-disable-next-line deprecation/deprecation
transaction.startChild({ op: 'span_2' });
for (let i = 0; i < 4000; i++);

// eslint-disable-next-line deprecation/deprecation
const span_3 = transaction.startChild({ op: 'span_3' });
for (let i = 0; i < 4000; i++);

// span_4 is the child of span_3 but doesn't finish.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });

// span_5 is another child of span_3 but finishes.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_5' }).end();

// span_3 also finishes
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/src/tracing.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
this._routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
op: ANGULAR_ROUTING_OP,
Expand DownExpand Up@@ -183,6 +184,7 @@ export class TraceDirective implements OnInit, AfterViewInit {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._tracingSpan = activeTransaction.startChild({
description: `<${this.componentName}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -225,6 +227,7 @@ export function TraceClassDecorator(): ClassDecorator {
target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
tracingSpan = activeTransaction.startChild({
description: `<${target.name}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -262,6 +265,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
activeTransaction.startChild({
description: `<${target.constructor.name}>`,
endTimestamp: now,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/tracing/span.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,10 @@ export class Span implements SpanInterface {
}

/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,8 @@ export function startInactiveSpan(context: StartSpanOptions): Span | undefined {
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand DownExpand Up@@ -240,7 +241,8 @@ function createChildSpanOrTransaction(
return undefined;
}
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember/addon/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
return result;
}
currentTransaction
// eslint-disable-next-line deprecation/deprecation
.startChild({
op,
description,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,7 @@ export function _instrumentEmberRouter(
'routing.instrumentation': '@sentry/ember',
},
});
// eslint-disable-next-line deprecation/deprecation
transitionSpan = activeTransaction?.startChild({
op: 'ui.ember.transition',
description: `route:${fromRoute} -> route:${toRoute}`,
Expand DownExpand Up@@ -212,6 +213,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
activeTransaction
// eslint-disable-next-line deprecation/deprecation
?.startChild({
op: `ui.ember.runloop.${queue}`,
origin: 'auto.ui.ember',
Expand DownExpand Up@@ -287,7 +289,7 @@ function processComponentRenderAfter(

if (componentRenderDuration * 1000 >= minComponentDuration) {
const activeTransaction = getActiveTransaction();

// eslint-disable-next-line deprecation/deprecation
activeTransaction?.startChild({
op,
description: payload.containerKey || payload.object,
Expand DownExpand Up@@ -373,6 +375,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
const endTimestamp = startTimestamp + measure.duration / 1000;

const transaction = getActiveTransaction();
// eslint-disable-next-line deprecation/deprecation
const span = transaction?.startChild({
op: 'ui.ember.init',
origin: 'auto.ui.ember',
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -186,6 +186,7 @@ export function pagesRouterInstrumentation(
// We don't want to finish the navigation transaction on `routeChangeComplete`, since users might want to attach
// spans to that transaction even after `routeChangeComplete` is fired (eg. HTTP requests in some useEffect
// hooks). Instead, we'll simply let the navigation transaction finish itself (it's an `IdleTransaction`).
// eslint-disable-next-line deprecation/deprecation
const nextRouteChangeSpan = navigationTransaction.startChild({
op: 'ui.nextjs.route-change',
origin: 'auto.ui.nextjs.pages_router_instrumentation',
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/utils/wrapperUtils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,6 +131,7 @@ export function withTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
spanToContinue = previousSpan;
}

// eslint-disable-next-line deprecation/deprecation
dataFetcherSpan = spanToContinue.startChild({
op: 'function.nextjs',
description: `${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`,
Expand DownExpand Up@@ -209,6 +210,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis

// Capture the route, since pre-loading, revalidation, etc might mean that this span may happen during another
// route's transaction
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
op: 'function.nextjs',
origin: 'auto.function.nextjs',
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,8 @@ function _createWrappedRequestMethodFactory(
const data = getRequestSpanData(requestUrl, requestOptions);

const requestSpan = shouldCreateSpan(rawRequestUrl)
? parentSpan?.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.http',
description: `${data['http.method']} ${data.url}`,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/integrations/undici/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,6 +310,7 @@ function createRequestSpan(
if (url.hash) {
data['http.fragment'] = url.hash;
}
// eslint-disable-next-line deprecation/deprecation
return activeSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.undici',
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/handlers.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -424,6 +424,7 @@ describe('tracingHandler', () => {
it('waits to finish transaction until all spans are finished, even though `transaction.end()` is registered on `res.finish` event first', done => {
const transaction = new Transaction({ name: 'mockTransaction', sampled: true });
transaction.initSpanRecorder();
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: 'reallyCoolHandler',
op: 'middleware',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/src/spanprocessor.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
const sentryParentSpan = otelParentSpanId && getSentrySpan(otelParentSpanId);

if (sentryParentSpan) {
// eslint-disable-next-line deprecation/deprecation
const sentryChildSpan = sentryParentSpan.startChild({
description: otelSpan.name,
instrumenter: 'otel',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/test/propagator.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,7 @@ describe('SentryPropagator', () => {
if (type === PerfType.Span) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { spanId, ...ctx } = transactionContext;
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({ ...ctx, description: transaction.name });
setSentrySpan(span.spanId, span);
}
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/spanExporter.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry
const { op, description, tags, data, origin } = getSpanData(span);
const allData = { ...removeSentryAttributes(attributes), ...data };

// eslint-disable-next-line deprecation/deprecation
const sentrySpan = sentryParentSpan.startChild({
description,
op,
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/profiler.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ class Profiler extends React.Component<ProfilerProps> {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._mountSpan = activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -85,6 +86,7 @@ class Profiler extends React.Component<ProfilerProps> {
const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
if (changedProps.length > 0) {
const now = timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this._updateSpan = this._mountSpan.startChild({
data: {
changedProps,
Expand DownExpand Up@@ -116,6 +118,7 @@ class Profiler extends React.Component<ProfilerProps> {
if (this._mountSpan && includeRender) {
// If we were able to obtain the spanId of the mount activity, we should set the
// next activity as a child to the component mount activity.
// eslint-disable-next-line deprecation/deprecation
this._mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand DownExpand Up@@ -183,6 +186,7 @@ function useProfiler(

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
return activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -201,6 +205,7 @@ function useProfiler(

return (): void => {
if (mountSpan && options.hasRenderSpan) {
// eslint-disable-next-line deprecation/deprecation
mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,7 @@ function makeWrappedDocumentRequestFunction(remixVersion?: number) {
const activeTransaction = getActiveTransaction();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: 'function.remix.document_request',
origin: 'auto.function.remix',
Expand DownExpand Up@@ -239,6 +240,7 @@ function makeWrappedDataFunction(
const currentScope = getCurrentScope();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: `function.remix.${name}`,
origin: 'auto.ui.remix',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/awsservices.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
const req = orig.call(this, operation, params);
req.on('afterBuild', () => {
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: describe(this, operation, params),
op: 'http.client',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-grpc.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
const scope = getCurrentScope();
const transaction = scope.getTransaction();
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `grpc.${serviceIdentifier}`,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const transaction = scope.getTransaction();
if (transaction) {
const httpMethod = reqOpts.method || 'GET';
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/performance.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export function trackComponent(options?: TrackComponentOptions): void {
}

function recordInitSpan(transaction: Transaction, componentName: string): Span {
// eslint-disable-next-line deprecation/deprecation
const initSpan = transaction.startChild({
op: UI_SVELTE_INIT,
description: componentName,
Expand DownExpand Up@@ -75,6 +76,7 @@ function recordUpdateSpans(componentName: string, initSpan?: Span): void {
const parentSpan =
initSpan && !initSpan.endTimestamp && initSpan.transaction === transaction ? initSpan : transaction;

// eslint-disable-next-line deprecation/deprecation
updateSpan = parentSpan.startChild({
op: UI_SVELTE_UPDATE,
description: componentName,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/client/router.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ function instrumentNavigations(startTransactionFn: (context: TransactionContext)
// If a routing span is still open from a previous navigation, we finish it.
routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
routingSpan = activeTransaction.startChild({
op: 'ui.sveltekit.routing',
description: 'SvelteKit Route Change',
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/test/client/router.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand DownExpand Up@@ -168,6 +169,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand Down
2 changes: 2 additions & 0 deletions packages/tracing-internal/src/browser/metrics/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@ export function startTrackingLongTasks(): void {
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
const duration = msToSec(entry.duration);

// eslint-disable-next-line deprecation/deprecation
transaction.startChild({
description: 'Main UI thread blocked',
op: 'ui.long-task',
Expand DownExpand Up@@ -115,6 +116,7 @@ export function startTrackingInteractions(): void {
span.data = { 'ui.component_name': componentName };
}

// eslint-disable-next-line deprecation/deprecation
transaction.startChild(span);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/metrics/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
transaction.startTimestamp = startTimestamp;
}

// eslint-disable-next-line deprecation/deprecation
return transaction.startChild({
startTimestamp,
...ctx,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,8 @@ export function xhrCallback(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
type: 'xhr',
'http.method': sentryXhrData.method,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,8 @@ export function instrumentFetchRequest(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
url,
type: 'fetch',
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,9 +8,9 @@ npx @sentry/migr8@latest

This will let you select which updates to run, and automatically update your code. Make sure to still review all code changes!

## Deprecate `startTransaction()`
## Deprecate `startTransaction()` & `span.startChild()`

In v8, the old performance API `startTransaction()` (as well as `hub.startTransaction()`) will be removed.
In v8, the old performance API `startTransaction()` (and `hub.startTransaction()`), as well as `span.startChild()`, will be removed.
Instead, use the new performance APIs:

* `startSpan()`
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentHub().getScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ app.get('/test-transaction', async function (req, res) {
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
Sentry.getCurrentScope().setSpan(transaction);

// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild();

span.end();
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,7 @@ Sentry.init({

// eslint-disable-next-line deprecation/deprecation
const transaction = Sentry.startTransaction({ name: 'test_transaction_1' });
// eslint-disable-next-line deprecation/deprecation
const span_1 = transaction.startChild({
op: 'span_1',
data: {
Expand All@@ -23,16 +24,20 @@ for (let i = 0; i < 2000; i++);
span_1.end();

// span_2 doesn't finish
// eslint-disable-next-line deprecation/deprecation
transaction.startChild({ op: 'span_2' });
for (let i = 0; i < 4000; i++);

// eslint-disable-next-line deprecation/deprecation
const span_3 = transaction.startChild({ op: 'span_3' });
for (let i = 0; i < 4000; i++);

// span_4 is the child of span_3 but doesn't finish.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_4', data: { qux: 'quux' } });

// span_5 is another child of span_3 but finishes.
// eslint-disable-next-line deprecation/deprecation
span_3.startChild({ op: 'span_5' }).end();

// span_3 also finishes
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/src/tracing.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -84,6 +84,7 @@ export class TraceService implements OnDestroy {
if (this._routingSpan) {
this._routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
this._routingSpan = activeTransaction.startChild({
description: `${navigationEvent.url}`,
op: ANGULAR_ROUTING_OP,
Expand DownExpand Up@@ -183,6 +184,7 @@ export class TraceDirective implements OnInit, AfterViewInit {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._tracingSpan = activeTransaction.startChild({
description: `<${this.componentName}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -225,6 +227,7 @@ export function TraceClassDecorator(): ClassDecorator {
target.prototype.ngOnInit = function (...args: any[]): ReturnType<typeof originalOnInit> {
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
tracingSpan = activeTransaction.startChild({
description: `<${target.name}>`,
op: ANGULAR_INIT_OP,
Expand DownExpand Up@@ -262,6 +265,7 @@ export function TraceMethodDecorator(): MethodDecorator {
const now = timestampInSeconds();
const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
activeTransaction.startChild({
description: `<${target.constructor.name}>`,
endTimestamp: now,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/tracing/span.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,10 @@ export class Span implements SpanInterface {
}

/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
public startChild(
spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -158,7 +158,8 @@ export function startInactiveSpan(context: StartSpanOptions): Span | undefined {
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand DownExpand Up@@ -240,7 +241,8 @@ function createChildSpanOrTransaction(
return undefined;
}
return parentSpan
? parentSpan.startChild(ctx)
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/ember/addon/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -88,6 +88,7 @@ export const instrumentRoutePerformance = <T extends RouteConstructor>(BaseRoute
return result;
}
currentTransaction
// eslint-disable-next-line deprecation/deprecation
.startChild({
op,
description,
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,7 @@ export function _instrumentEmberRouter(
'routing.instrumentation': '@sentry/ember',
},
});
// eslint-disable-next-line deprecation/deprecation
transitionSpan = activeTransaction?.startChild({
op: 'ui.ember.transition',
description: `route:${fromRoute} -> route:${toRoute}`,
Expand DownExpand Up@@ -212,6 +213,7 @@ function _instrumentEmberRunloop(config: EmberSentryConfig): void {

if ((now - currentQueueStart) * 1000 >= minQueueDuration) {
activeTransaction
// eslint-disable-next-line deprecation/deprecation
?.startChild({
op: `ui.ember.runloop.${queue}`,
origin: 'auto.ui.ember',
Expand DownExpand Up@@ -287,7 +289,7 @@ function processComponentRenderAfter(

if (componentRenderDuration * 1000 >= minComponentDuration) {
const activeTransaction = getActiveTransaction();

// eslint-disable-next-line deprecation/deprecation
activeTransaction?.startChild({
op,
description: payload.containerKey || payload.object,
Expand DownExpand Up@@ -373,6 +375,7 @@ function _instrumentInitialLoad(config: EmberSentryConfig): void {
const endTimestamp = startTimestamp + measure.duration / 1000;

const transaction = getActiveTransaction();
// eslint-disable-next-line deprecation/deprecation
const span = transaction?.startChild({
op: 'ui.ember.init',
origin: 'auto.ui.ember',
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -186,6 +186,7 @@ export function pagesRouterInstrumentation(
// We don't want to finish the navigation transaction on `routeChangeComplete`, since users might want to attach
// spans to that transaction even after `routeChangeComplete` is fired (eg. HTTP requests in some useEffect
// hooks). Instead, we'll simply let the navigation transaction finish itself (it's an `IdleTransaction`).
// eslint-disable-next-line deprecation/deprecation
const nextRouteChangeSpan = navigationTransaction.startChild({
op: 'ui.nextjs.route-change',
origin: 'auto.ui.nextjs.pages_router_instrumentation',
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/common/utils/wrapperUtils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -131,6 +131,7 @@ export function withTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
spanToContinue = previousSpan;
}

// eslint-disable-next-line deprecation/deprecation
dataFetcherSpan = spanToContinue.startChild({
op: 'function.nextjs',
description: `${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`,
Expand DownExpand Up@@ -209,6 +210,7 @@ export async function callDataFetcherTraced<F extends (...args: any[]) => Promis

// Capture the route, since pre-loading, revalidation, etc might mean that this span may happen during another
// route's transaction
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
op: 'function.nextjs',
origin: 'auto.function.nextjs',
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -251,7 +251,8 @@ function _createWrappedRequestMethodFactory(
const data = getRequestSpanData(requestUrl, requestOptions);

const requestSpan = shouldCreateSpan(rawRequestUrl)
? parentSpan?.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.http',
description: `${data['http.method']} ${data.url}`,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/integrations/undici/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,6 +310,7 @@ function createRequestSpan(
if (url.hash) {
data['http.fragment'] = url.hash;
}
// eslint-disable-next-line deprecation/deprecation
return activeSpan?.startChild({
op: 'http.client',
origin: 'auto.http.node.undici',
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/handlers.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -424,6 +424,7 @@ describe('tracingHandler', () => {
it('waits to finish transaction until all spans are finished, even though `transaction.end()` is registered on `res.finish` event first', done => {
const transaction = new Transaction({ name: 'mockTransaction', sampled: true });
transaction.initSpanRecorder();
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: 'reallyCoolHandler',
op: 'middleware',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/src/spanprocessor.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ export class SentrySpanProcessor implements OtelSpanProcessor {
const sentryParentSpan = otelParentSpanId && getSentrySpan(otelParentSpanId);

if (sentryParentSpan) {
// eslint-disable-next-line deprecation/deprecation
const sentryChildSpan = sentryParentSpan.startChild({
description: otelSpan.name,
instrumenter: 'otel',
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-node/test/propagator.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,7 @@ describe('SentryPropagator', () => {
if (type === PerfType.Span) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { spanId, ...ctx } = transactionContext;
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({ ...ctx, description: transaction.name });
setSentrySpan(span.spanId, span);
}
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/src/spanExporter.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -204,6 +204,7 @@ function createAndFinishSpanForOtelSpan(node: SpanNode, sentryParentSpan: Sentry
const { op, description, tags, data, origin } = getSpanData(span);
const allData = { ...removeSentryAttributes(attributes), ...data };

// eslint-disable-next-line deprecation/deprecation
const sentrySpan = sentryParentSpan.startChild({
description,
op,
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/profiler.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,7 @@ class Profiler extends React.Component<ProfilerProps> {

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
this._mountSpan = activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -85,6 +86,7 @@ class Profiler extends React.Component<ProfilerProps> {
const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);
if (changedProps.length > 0) {
const now = timestampInSeconds();
// eslint-disable-next-line deprecation/deprecation
this._updateSpan = this._mountSpan.startChild({
data: {
changedProps,
Expand DownExpand Up@@ -116,6 +118,7 @@ class Profiler extends React.Component<ProfilerProps> {
if (this._mountSpan && includeRender) {
// If we were able to obtain the spanId of the mount activity, we should set the
// next activity as a child to the component mount activity.
// eslint-disable-next-line deprecation/deprecation
this._mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand DownExpand Up@@ -183,6 +186,7 @@ function useProfiler(

const activeTransaction = getActiveTransaction();
if (activeTransaction) {
// eslint-disable-next-line deprecation/deprecation
return activeTransaction.startChild({
description: `<${name}>`,
op: REACT_MOUNT_OP,
Expand All@@ -201,6 +205,7 @@ function useProfiler(

return (): void => {
if (mountSpan && options.hasRenderSpan) {
// eslint-disable-next-line deprecation/deprecation
mountSpan.startChild({
description: `<${name}>`,
endTimestamp: timestampInSeconds(),
Expand Down
2 changes: 2 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -184,6 +184,7 @@ function makeWrappedDocumentRequestFunction(remixVersion?: number) {
const activeTransaction = getActiveTransaction();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: 'function.remix.document_request',
origin: 'auto.function.remix',
Expand DownExpand Up@@ -239,6 +240,7 @@ function makeWrappedDataFunction(
const currentScope = getCurrentScope();

try {
// eslint-disable-next-line deprecation/deprecation
const span = activeTransaction?.startChild({
op: `function.remix.${name}`,
origin: 'auto.ui.remix',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/awsservices.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,7 @@ function wrapMakeRequest<TService extends AWSService, TResult>(
const req = orig.call(this, operation, params);
req.on('afterBuild', () => {
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: describe(this, operation, params),
op: 'http.client',
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-grpc.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,6 +111,7 @@ function fillGrpcFunction(stub: Stub, serviceIdentifier: string, methodName: str
const scope = getCurrentScope();
const transaction = scope.getTransaction();
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${callType} ${methodName}`,
op: `grpc.${serviceIdentifier}`,
Expand Down
1 change: 1 addition & 0 deletions packages/serverless/src/google-cloud-http.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,6 +56,7 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction {
const transaction = scope.getTransaction();
if (transaction) {
const httpMethod = reqOpts.method || 'GET';
// eslint-disable-next-line deprecation/deprecation
span = transaction.startChild({
description: `${httpMethod} ${reqOpts.uri}`,
op: `http.client.${identifyService(this.apiEndpoint)}`,
Expand Down
2 changes: 2 additions & 0 deletions packages/svelte/src/performance.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export function trackComponent(options?: TrackComponentOptions): void {
}

function recordInitSpan(transaction: Transaction, componentName: string): Span {
// eslint-disable-next-line deprecation/deprecation
const initSpan = transaction.startChild({
op: UI_SVELTE_INIT,
description: componentName,
Expand DownExpand Up@@ -75,6 +76,7 @@ function recordUpdateSpans(componentName: string, initSpan?: Span): void {
const parentSpan =
initSpan && !initSpan.endTimestamp && initSpan.transaction === transaction ? initSpan : transaction;

// eslint-disable-next-line deprecation/deprecation
updateSpan = parentSpan.startChild({
op: UI_SVELTE_UPDATE,
description: componentName,
Expand Down
1 change: 1 addition & 0 deletions packages/sveltekit/src/client/router.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ function instrumentNavigations(startTransactionFn: (context: TransactionContext)
// If a routing span is still open from a previous navigation, we finish it.
routingSpan.end();
}
// eslint-disable-next-line deprecation/deprecation
routingSpan = activeTransaction.startChild({
op: 'ui.sveltekit.routing',
description: 'SvelteKit Route Change',
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/test/client/router.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,6 +117,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand DownExpand Up@@ -168,6 +169,7 @@ describe('sveltekitRoutingInstrumentation', () => {
},
});

// eslint-disable-next-line deprecation/deprecation
expect(returnedTransaction?.startChild).toHaveBeenCalledWith({
op: 'ui.sveltekit.routing',
origin: 'auto.ui.sveltekit',
Expand Down
2 changes: 2 additions & 0 deletions packages/tracing-internal/src/browser/metrics/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,6 +76,7 @@ export function startTrackingLongTasks(): void {
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
const duration = msToSec(entry.duration);

// eslint-disable-next-line deprecation/deprecation
transaction.startChild({
description: 'Main UI thread blocked',
op: 'ui.long-task',
Expand DownExpand Up@@ -115,6 +116,7 @@ export function startTrackingInteractions(): void {
span.data = { 'ui.component_name': componentName };
}

// eslint-disable-next-line deprecation/deprecation
transaction.startChild(span);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/tracing-internal/src/browser/metrics/utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ export function _startChild(transaction: Transaction, { startTimestamp, ...ctx }
transaction.startTimestamp = startTimestamp;
}

// eslint-disable-next-line deprecation/deprecation
return transaction.startChild({
startTimestamp,
...ctx,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/browser/request.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -275,7 +275,8 @@ export function xhrCallback(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
type: 'xhr',
'http.method': sentryXhrData.method,
Expand Down
3 changes: 2 additions & 1 deletion packages/tracing-internal/src/common/fetch.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,8 @@ export function instrumentFetchRequest(

const span =
shouldCreateSpanResult && parentSpan
? parentSpan.startChild({
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild({
data: {
url,
type: 'fetch',
Expand Down
Loading