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

Add continueTrace function #9011

Closed
lforst opened this issue Sep 13, 2023 · 4 comments · Fixed by #9164
Closed

Add continueTrace function #9011

lforst opened this issue Sep 13, 2023 · 4 comments · Fixed by #9164
Assignees

Comments

@lforst
Copy link
Member

lforst commented Sep 13, 2023

Problem Statement

It would be cool for any unsupported frameworks and even for the SDK internally in higher order SDKs to have a function that continues a trace from a sentry-trace and baggage value and starts a new transaction.

Solution Brainstorm

Function signature:

interface continueTrace<V> {
  (traceInformation: { sentryTrace: string, baggage: string }, (tracedTransaction: Transaction) => V): V
}

Example:

export function handler(req, res, next) {
  return continueTrace({
    sentryTrace: req.headers["sentry-trace"],
    baggage: req.headers["baggage"]
  }, (transaction) => {
    transaction.seTag('foo', 'bar');
    return next()
  });
}
@AbhiPrasad
Copy link
Member

Let's make this work like Python does https://docs.sentry.io/platforms/python/usage/distributed-tracing/custom-instrumentation/

No need to assume performance monitoring, just mutate tracing information.

@lforst
Copy link
Member Author

lforst commented Sep 13, 2023

Yea we can copy what python does except for taking headers. Saying headers is overly specific and you can propagate tracing information over other mechanisms than headers. (CLI args, env-vars, ...)

@Lms24
Copy link
Member

Lms24 commented Sep 14, 2023

I like the python approach insofar as we provide a continueTrace function taking an object with the information and we can expose additional helpers to extract the information from whatever source they can come from.

@stephanie-anderson stephanie-anderson changed the title RFC: Add continueTrace function Add continueTrace function Sep 18, 2023
@HazAT
Copy link
Member

HazAT commented Sep 25, 2023

Please update this internal slack conversation once this ships
https://sentry.slack.com/archives/C05ABS7V7PY/p1694704574720109?thread_ts=1694674634.442359&cid=C05ABS7V7PY

@smeubank smeubank assigned Lms24 and mydea and unassigned Lms24 Oct 2, 2023
@AbhiPrasad AbhiPrasad removed their assignment Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants