getsentry / sentry-docs

Sentry's documentation (and tools to build it)
https://docs.sentry.io
Other
331 stars 1.46k forks source link

Improve docs for `extractTraceparentData` function #5647

Closed abrahamq closed 1 year ago

abrahamq commented 3 years ago

Package + Version

Version:

5.29.0

Description

I'm trying to write a graphql-middleware to integrate with our app. Following the instructions here I tried to modify the express middleware already in sentry for this use; however, when I try to call Span.fromTraceparent I receive the titular error. I've looked through the compiled javascript and that function is nowhere to be found even though it is present on the typedoc here: https://getsentry.github.io/sentry-javascript/classes/tracing.span-2.html#fromtraceparent

Thanks!

abrahamq commented 3 years ago

Here's a minimal repo, if that helps: https://github.com/abrahamq/minimal-sentry-repo

AbhiPrasad commented 3 years ago

You can use the extractTraceparentData function. Like so:

https://github.com/getsentry/sentry-javascript/blob/dcdb1130586e3a4d42b3611b41952f329a8da94e/packages/node/src/handlers.ts#L59-L69

We need to improve the documentation here.

smeubank commented 2 years ago

@lobsterkatie

instead of documenting this internal helper function, we should consider adding according to spec the proper public APIs

lobsterkatie commented 2 years ago

Related: https://github.com/getsentry/sentry-docs/issues/2984

See discussion of continueFromHeaders and iterHeaders (the spec API Steven mentions above) here.