-
Notifications
You must be signed in to change notification settings - Fork 833
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
Ignore null / invalid spancontext and handle null attributes for links. #2985
Conversation
if (spanContext == null || !spanContext.isValid()) { | ||
return this; | ||
} | ||
if (!spanContext.isValid()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is redundant with the check above, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops
@@ -83,12 +83,24 @@ public SpanBuilder setSpanKind(SpanKind spanKind) { | |||
|
|||
@Override | |||
public SpanBuilder addLink(SpanContext spanContext) { | |||
if (spanContext == null || !spanContext.isValid()) { | |||
return this; | |||
} | |||
addLink(LinkData.create(spanContext)); | |||
return this; | |||
} | |||
|
|||
@Override | |||
public SpanBuilder addLink(SpanContext spanContext, Attributes attributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also document in the API, same as you did in the specs:
"Implementation MAY ignore ...."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
Fixes #2955
Spec PR :open-telemetry/opentelemetry-specification#1492