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

API: Make SpanContext.getInvalid() public #787

Closed
carlosalberto opened this issue Jan 24, 2020 · 2 comments
Closed

API: Make SpanContext.getInvalid() public #787

carlosalberto opened this issue Jan 24, 2020 · 2 comments
Assignees

Comments

@carlosalberto
Copy link
Contributor

For Propagators and other components returning invalid SpanContext instances it would be handy to share the SpanContext.getInvalid() instance, which is currently private.

If I remember correctly, there were a few reasons having keeping it private, mostly around users not abusing it. Do we want to change this?

(Observe this would be mostly an optimization. Any SpanContext can be created and users can check its getValid() method. On the other hand, TraceId and SpanId do expose their invalid instances).

See #767 for example.

@DotSpy
Copy link
Member

DotSpy commented Feb 8, 2020

Trace id and span id now exposing invalid states they have

  public static SpanId getInvalid() {
    return INVALID;
  }

for now SpanContext.getInvalid() just wrapping all public methods

  private static final SpanContext INVALID =
      create(
          TraceId.getInvalid(),
          SpanId.getInvalid(),
          TraceFlags.getDefault(),
          TraceState.getDefault());

so no harm for current state of project to make it public, otherwise TraceId.getInvalid() and SpanId.getInvalid() should be protected\private too

@jkwatson
Copy link
Contributor

complete with #896

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

4 participants