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

Set errors in span metadata #315

Closed
willyyang opened this issue Oct 15, 2018 · 3 comments
Closed

Set errors in span metadata #315

willyyang opened this issue Oct 15, 2018 · 3 comments
Labels
community question Further information is requested

Comments

@willyyang
Copy link

willyyang commented Oct 15, 2018

How do I see the errors set from the span tag?

const querySpan = tracer.startSpan('xx-query', {
    childOf: resolverSpan.context()
})
querySpan.setTag('traceID', JSON.stringify(querySpan.context().traceId))

querySpan.setTag('db', 'query')
querySpan.setTag('error', 'this should be my message')
tracer.scopeManager().activate(querySpan)
...
querySpan.finish()

screen shot 2018-10-15 at 12 39 16 pm
screen shot 2018-10-15 at 12 39 26 pm

@willyyang willyyang changed the title Set graphql resolver errors in span metadata Set errors in span metadata Oct 15, 2018
@rochdev
Copy link
Member

rochdev commented Oct 15, 2018

Not sure I understand the question. Are you trying to flag a custom span as an error? If that's the case, there are a few tags that you can set: error.type, error.msg and error.stack

@rochdev rochdev added question Further information is requested community labels Oct 15, 2018
@rochdev
Copy link
Member

rochdev commented Oct 15, 2018

Basically it should look something like this:

try {
  // some operation that may fail
} catch (e) {
  span.addTags({
    'error.type': e.name,
    'error.msg': e.message,
    'error.stack': e.stack
  })
}

@rochdev
Copy link
Member

rochdev commented Oct 26, 2018

I'm inferring from the above thumbs up that this fixed your issue. Please feel free to reopen if that's not the case.

@rochdev rochdev closed this as completed Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants