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

StatusCode.OK is not respected as per the OpenTelemetry spec #6207

Closed
apederson94 opened this issue Feb 7, 2024 · 6 comments · Fixed by #6209
Closed

StatusCode.OK is not respected as per the OpenTelemetry spec #6207

apederson94 opened this issue Feb 7, 2024 · 6 comments · Fixed by #6209
Labels
Bug Something isn't working good first issue

Comments

@apederson94
Copy link
Contributor

Describe the bug

When using span.setStatus(StatusCode.OK) from the Java SDK, the automatic instrumentation does not respect that this is final. The spec clearly states this here. This is affecting our ability to correctly administer our service and is a big problem for us.

As far as I can really tell, the issue is that there is some way that the status code is being set to ERROR after we return from our code. I have tried setting to StatusCode.OK right before we return a 500 to the caller and even that does not work. I suspect that there are however multiple locations that do not respect the spec and will need to be updated given the absoluteness of what the spec indicates.

Steps to reproduce

  1. Setup a project that uses the javaagent as instrumentation
  2. During a call set the status to StatusCode.OK
  3. Return a 500 from this project to the client
  4. Observe in Zipkin or other span viewer that the error status is not respected and is set to StatusCode.ERROR

Expected behavior

The span should not be marked as an error span if it has been manually set to StatusCode.OK

Actual behavior

The span is still being set as an error span

Javaagent or library instrumentation version

1.32.1

Environment

JDK: openjdk 11.0.21
OS: linux

Additional context

I am willing to sync up with anyone that will tackle this issue in a call or provide more context as is needed asynchronously. I just want to get this fixed since it is blocking us.

@apederson94 apederson94 added the Bug Something isn't working label Feb 7, 2024
@trask
Copy link
Member

trask commented Feb 7, 2024

The spec clearly states this here.

@jack-berg do you think this is a bug in SdkSpan?

@jack-berg
Copy link
Member

Yup this seems like a pretty clear bug. Transferring to opentelemetry-java so we can address it in the appropriate place.

@jack-berg jack-berg transferred this issue from open-telemetry/opentelemetry-java-instrumentation Feb 7, 2024
@apederson94
Copy link
Contributor Author

apederson94 commented Feb 8, 2024

Just want to confirm that my PR will also fix the auto instrumentation from the Java agent. I have reviewed some of the code but can't quite seem to piece together whether or not this PR will fix that use case or not.

@trask
Copy link
Member

trask commented Feb 8, 2024

Just want to confirm that my PR will also fix the auto instrumentation from the Java agent. I have reviewed some of the code but can't quite seem to piece together whether or not this PR will fix that use case or not.

I believe this should also fix the issue with the Java agent once the fix is released and we pull the latest SDK version into the Java agent

@apederson94
Copy link
Contributor Author

Awesome! Thanks @trask and @jack-berg! This should unblock our team from a huge issue that we are seeing once released. If I understand correctly, this should all be released somewhere around Wednesday next week?

@trask
Copy link
Member

trask commented Feb 8, 2024

this should all be released somewhere around Wednesday next week?

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants