Skip to content

[@sentry/tracing][express] Span is missing at the end of the transaction #3159

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

Closed
6 tasks done
special-character opened this issue Jan 8, 2021 · 2 comments
Closed
6 tasks done
Labels
Package: node Issues related to the Sentry Node SDK

Comments

@special-character
Copy link

special-character commented Jan 8, 2021

Package + Version

Description

When I am using Sentry tracing, there appears to be a span missing at the end of the request. I found this GH issue that had the same issue but it was seemingly resolved and I made sure I am using the latest version.

image

I believe I have this set up correctly from the docs:

import { server } from 'nexus'
import * as Sentry from '@sentry/node'
import * as Tracing from '@sentry/tracing'

// @ts-ignore
Sentry.init({
  dsn: 'Secret dsn 🤫',
  environment: process.env.APP_ENVIRONMENT,
  release: process.env.GIT_SHA,
  enabled: true,
  integrations: [
    new Sentry.Integrations.Http({ tracing: true }),
    new Tracing.Integrations.Express({
      app: server.express,
    }),
  ],
  tracesSampleRate: process.env.APP_ENVIRONMENT === 'production' ? 0.5 : 1,
})

server.express.use(Sentry.Handlers.requestHandler())
server.express.use(Sentry.Handlers.tracingHandler())

export { Sentry }

I will keep digging a bit but wanted to post here in case someone else is still running into this or could help out, thanks. This also might be because I am using nexus and there is something that it can't see but I am not entirely sure yet.

@special-character
Copy link
Author

After a little more digging, I think a span is actually getting dropped but still don't know why.

I log a span in the express integration for case 3 and it logged this:

Span {
  traceId: '575dfa159e6448f5a81b5ed582031ba1',
  spanId: '8ecc928442e55836',
  startTimestamp: 1610133446.1545632,
  tags: {},
  data: {},
  parentSpanId: '9ef18c33332c2275',
  sampled: true,
  op: 'middleware.use',
  description: 'router',
  spanRecorder:
   SpanRecorder { spans: [ [Transaction], [Circular] ], _maxlen: 1000 },
  transaction:
   Transaction {
     traceId: '575dfa159e6448f5a81b5ed582031ba1',
     spanId: '9ef18c33332c2275',
     startTimestamp: 1610133446.1543927,
     tags: {},
     data: {},
     op: 'http.server',
     _measurements: {},
     _hub: Hub { _version: 3, _stack: [Array] },
     name: 'POST /graphql',
     _trimEnd: undefined,
     transaction: [Circular],
     sampled: true,
     spanRecorder: SpanRecorder { spans: [Array], _maxlen: 1000 } } }

It appears that the function in the fn.call block is never called (console logged in there too but it never happened).

When I found the traceId in sentry, the span with the above id wasn't on the trace.

@github-actions
Copy link
Contributor

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: node Issues related to the Sentry Node SDK
Projects
None yet
Development

No branches or pull requests

3 participants