Skip to content

http.client always connected to root transaction, not under ChildSpan #7090

@kudlav

Description

@kudlav

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/node

SDK Version

7.36.0

Framework Version

16.19.0

Link to Sentry event

https://sentry.io/maptiler/performance/tileserver:a065ccba6659425cbc28c4b93238659b

SDK Setup

Sentry.init({
  dsn: DSN,
  debug: true,
  attachStacktrace: true,
  tracesSampleRate: 1,
  integrations: [
    new RewriteFrames({ root: global.__rootdir__ }),
    new Sentry.Integrations.Http({ tracing: true }),
  ],
  ...
});

const transaction = Sentry.startTransaction({
    op: 'rootApp',
    name: 'fubar',
    metadata: { request: req, source: 'url'  },
  }, { request: req }
);

Sentry.configureScope((scope) => {
  scope.setSpan(transaction);
});

Steps to Reproduce

const workSpan = Sentry.getCurrentHub().getScope()?.getTransaction()?.startChild('work');

const fetchSpan = workSpan?.StartChild({ op: 'fetch' });
await dbHeavyOper();
fetchSpan?.finish();

const computeSpan = workSpan?.StartChild({ op: 'compute' });
await doSomething();
span?.finish();

workSpan?.finish();

similar to:
getsentry/sentry-dotnet#2023

Expected Result

Event Details:

  • rootApp
    • work
      • fetch
        • htp.client
        • htp.client
        • htp.client
        • htp.client
        • ...
      • compute

Actual Result

Event Details:

  • rootApp
    • work
      • fetch
      • compute
    • htp.client
    • htp.client
    • htp.client
    • htp.client
    • ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions