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

What's the recommend way to indicate debug is also implicated sampled in tracing context #43

Open
TommyCpp opened this issue Sep 23, 2020 · 1 comment

Comments

@TommyCpp
Copy link

Hi, so we are have some discussion around how should the tracing context handle the situation where the debug is also a implicated sampled decision.

We have a bitmask to represent the sampling state in tracing context where sampled and debug are represent in different bit. And the tracing context has isSampled() method to tell user whether or not to record current span.

In order to make sure isSampled() method returns true when the sampling state is either debug or sampled. We have the following two choices.

  1. Set debug bit and sampled bit when decision is debug. And isSampled() method will simplely return whether the sampled bit is set.

  2. Set debug bit only when decision is debug. But isSampled() method will have to return true if debug bit or sampled bit is set.

We are wonder if there is a preferred way from the spec standpoint. Thanks in advance!

@codefromthecrypt
Copy link
Member

in brave, we ensure the sampling bits are assigned when debug is, even if they weren't propagated. This means that outgoing would have both sampled and debug even if sampled wasn't passed on the way it. This is better in practice as some tools don't understand debug.

  static int debug(boolean debug, int flags) {
    if (debug) {
      flags |= FLAG_DEBUG | FLAG_SAMPLED_SET | FLAG_SAMPLED;
    } else {
      flags &= ~FLAG_DEBUG;
    }
    return flags;
  }

https://github.com/openzipkin/brave/blob/master/brave/src/main/java/brave/propagation/SamplingFlags.java#L178-L185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants