Skip to content

Set error tag to false when string value is false#97

Merged
mmenindezsegura merged 3 commits intoExpediaDotCom:masterfrom
eocantu:skip-error-false
Mar 4, 2021
Merged

Set error tag to false when string value is false#97
mmenindezsegura merged 3 commits intoExpediaDotCom:masterfrom
eocantu:skip-error-false

Conversation

@eocantu
Copy link
Copy Markdown
Contributor

@eocantu eocantu commented Mar 3, 2021

This prevents setting the error tag to true when the zipkin error tag value is "false"

mmenindezsegura
mmenindezsegura previously approved these changes Mar 4, 2021

private static List<Tag> fromZipkinTag(String key, String value) {
if ("error".equalsIgnoreCase(key)) {
if ("error".equalsIgnoreCase(key) && !"false".equalsIgnoreCase(value)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@absrivastava @kapilra Would like your input on this one, change seems pretty straightforward, however I'm not sure if not setting this tag when it's false could have more implications that I'm not aware.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me it shouldn't matter, if it's false ... I don't see any problem with this, Just want to double check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember back in the DT workshop in Gurgaon this was something Haystack supported to have feature parity with zipkin in terms of error cc @worldtiki

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better approach would be an else statement where it sets the errorTag explicitly to false when it's handling an error tag with a false value instead of skipping altogether. That way we're still transforming the tag from string to boolean but not setting it to true all the time.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eocantu is this something that you are adding manually or is the instrumentation lib that you are using adding this tag?

I'm asking because the error tag should contain a string with an error message and it's the existence of the tag that determines if the span contains errors or not, and not the value of the tag.

Ie, error=false means that there was an error and that the error message is "false".

Even though this is semantically incorrect, I can't think of anyone who would use the word "false" as an error message. Given that the two models (Haystack and Zipkin) are similar but not exactly alike I understand the reason for this change but I think it would be useful to know if this tag was added manually or not.

Regarding explicitly setting it to false when there are no errors, that's basically a no-op statement and will just add more information to transmit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@worldtiki Per the opentracing API, the error tag is a boolean. And if I understand correctly, technically you can set it to false and it would still be valid (regardless of whether you transmit more information or not).

Our instrumentation uses Jaeger with a reporter that uses the ThriftSpanConverter and all tags are simply converted to strings. I also tested the ZipkinV2Reporter which uses the V2SpanConverter and you also end up with an error string tag with the value of false

@eocantu eocantu changed the title Skip setting error tag when it's false Set error tag to false when string value is false Mar 4, 2021
@mmenindezsegura mmenindezsegura merged commit 623224c into ExpediaDotCom:master Mar 4, 2021
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

Successfully merging this pull request may close these issues.

4 participants