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

Manual Trace Propagation missing in docs #11127

Open
thinkocapo opened this issue Aug 20, 2024 · 7 comments
Open

Manual Trace Propagation missing in docs #11127

thinkocapo opened this issue Aug 20, 2024 · 7 comments
Labels

Comments

@thinkocapo
Copy link
Contributor

thinkocapo commented Aug 20, 2024

Core or SDK?

Platform/SDK

Which part? Which one?

Browser JS and Node JS

Description

We show Automatica Trace Propagation where the sentry sdk adds a sentry-trace header for you. What about if you need to obtain this sentry-trace id yourself and do something with it?

What if you have trace id's coming from a different vendor sdk or trace system and you want to set it as a custom tag in the sentry sdk?

Image

Suggested Solution

"You're either propagating a trace into Sentry, or you're propagating a trace out of sentry and into somewhere else. Here are both techniques 1,2"

  1. Set the Trace Id onto Sentry - code example showing something like
// parse it from wherever you have it already
traceId = my_non-sentrytrace.getTraceID()
sentrySDK.setTag("non-sentrytraceId", traceId)
  1. Get the Sentry Trace Id and Set it Somewhere Else
beforeSendTransaction(transction) {
  sentryTraceId = transaction.traceId
  // do something with your sentryTraceId...propagate it
}

and this is an option too:

// you can do this while the transaction is still being recorded, you don't have to wait for beforeSendTransaction
sentryTraceId = sentrysdk.scope.traceId
// do something with your sentryTraceId...propagate it

Something I wrote to a customer, he siad it made sense, "There are sdk callback functions that execute right before the sentry_sdk sends the event to Sentry, and during that callback you can analyze the event and obtain properties off of it (like sentry-traceId). beforeSendTransaction"

@thinkocapo thinkocapo added the Type: Content Issues about the contents of our docs label Aug 20, 2024
@getsantry
Copy link
Contributor

getsantry bot commented Aug 20, 2024

Auto-routing to @getsentry/product-owners-issues for triage ⏲️

@getsantry
Copy link
Contributor

getsantry bot commented Aug 20, 2024

Routing to @getsentry/product-owners-sdks-web-frontend for triage ⏲️

@getsantry
Copy link
Contributor

getsantry bot commented Aug 20, 2024

Routing to @getsentry/product-owners-sdks-web-backend for triage ⏲️

@smeubank
Copy link
Member

regarding standards and compatibility across stacks and vendors

getsentry/team-sdks#41

@cleptric i believe there was an issue that came up which forced us to rollback some of the changes

@cleptric
Copy link
Member

We need better controls how people can opt-out of traces being continued from an unknown 3rd party before we can implement the W3C tracepreant header in more SDKs. This will be part of the overall Span Streaming work we will kick-off soon.

@mydea
Copy link
Member

mydea commented Sep 5, 2024

FWIW we have these docs here: https://docs.sentry.io/platforms/javascript/guides/react/tracing/trace-propagation/custom-instrumentation/#inject-tracing-information-into-outgoing-requests which explain how to extract trace propagation data. IMHO that should cover manual use cases as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Waiting for: Community
Development

No branches or pull requests

6 participants