Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(remix): Do not skip error handling if tracing is not enabled. #5811

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/remix/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ function makeWrappedDocumentRequestFunction(
const activeTransaction = getActiveTransaction();
const currentScope = getCurrentHub().getScope();

if (!activeTransaction || !currentScope) {
if (!currentScope) {
return origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context);
}

try {
const span = activeTransaction.startChild({
const span = activeTransaction?.startChild({
op: 'remix.server.documentRequest',
description: activeTransaction.name,
tags: {
Expand All @@ -125,7 +125,7 @@ function makeWrappedDocumentRequestFunction(

res = await origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context);

span.finish();
span?.finish();
} catch (err) {
captureRemixServerException(err, 'documentRequest');
throw err;
Expand All @@ -141,12 +141,12 @@ function makeWrappedDataFunction(origFn: DataFunction, id: string, name: 'action
const activeTransaction = getActiveTransaction();
const currentScope = getCurrentHub().getScope();

if (!activeTransaction || !currentScope) {
if (!currentScope) {
return origFn.call(this, args);
}

try {
const span = activeTransaction.startChild({
const span = activeTransaction?.startChild({
op: `remix.server.${name}`,
description: id,
tags: {
Expand All @@ -162,7 +162,7 @@ function makeWrappedDataFunction(origFn: DataFunction, id: string, name: 'action
res = await origFn.call(this, args);

currentScope.setSpan(activeTransaction);
span.finish();
span?.finish();
} catch (err) {
captureRemixServerException(err, name);
throw err;
Expand Down