-
Notifications
You must be signed in to change notification settings - Fork 828
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
setStatus method conforms to the specified behavior regarding status … #6808
base: main
Are you sure you want to change the base?
Conversation
…code priorities and description handling Relate to open-telemetry#6797
this.status = StatusData.create(statusCode, description); | ||
} | ||
return this; | ||
synchronized (lock) { |
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.
We use spotless to ensure consist code formatting. Please run ./gradlew spotlessApply
.
@@ -418,22 +418,37 @@ private void addTimedEvent(EventData timedEvent) { | |||
|
|||
@Override | |||
public ReadWriteSpan setStatus(StatusCode statusCode, @Nullable String description) { | |||
if (statusCode == null) { | |||
return this; | |||
} |
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.
Why remove this?
|
||
// Prevent setting a lower priority status | ||
if (currentStatusCode == StatusCode.OK) { | ||
logger.log(Level.FINE, "Calling setStatus() on a Span that is already set to OK."); |
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.
Only log a warning the target status code is != StatusCode.OK
.
if (statusCode == StatusCode.ERROR) { | ||
this.status = StatusData.create(statusCode, description); // Allow description for ERROR | ||
} else { | ||
this.status = StatusData.create(statusCode, null); // Ignore description for non-ERROR statuses |
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.
#nit: Let's skip the extra allocation if the status code doesn't stand to change.
this.status = StatusData.create(statusCode, null); // Ignore description for non-ERROR statuses | |
if (currentStatusCode != statusCode) { | |
this.status = StatusData.create(statusCode, null); // Ignore description for non-ERROR statuses | |
} |
…code priorities and description handling
Relate to #6797