-
Notifications
You must be signed in to change notification settings - Fork 657
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
Export span status to Jaeger #367
Export span status to Jaeger #367
Conversation
Signed-off-by: Daniel González Lopes <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #367 +/- ##
=========================================
Coverage ? 85.26%
=========================================
Files ? 38
Lines ? 1920
Branches ? 225
=========================================
Hits ? 1637
Misses ? 219
Partials ? 64
Continue to review full report at Codecov.
|
I'm wondering if we should try to export the status in some way to Jaeger. Looking at https://github.com/jaegertracing/jaeger-idl/blob/master/thrift/jaeger.thrift it appears to me that there is not any status related field. Perhaps it could be encoded as a tag? |
It sounds like a good idea @mauriciovasquezbernal. From taking a quick look at the Go client, I think that they are doing exactly that. |
@dgzlopes do you have plans to implement that? If not I'll open an issue to keep track of it. |
Sure, I'm happy to implement it @mauriciovasquezbernal. Meanwhile, I'm going to change the title and the status of this pull request. |
Also, from taking a closer look at the Go implementation I see that they set an "error" tag in the Jaeger span if |
Yes! That would be awesome. |
I think this is something that should be defined in the spec, similar to open-telemetry/opentelemetry-specification#380 |
I opened an issue in the specs repo to track it open-telemetry/opentelemetry-specification#414. |
Signed-off-by: Daniel González Lopes <[email protected]>
I'm researching why Travis is failing. Locally all the Update: Now I'm able to reproduce it locally :) |
Based on the changes of open-telemetry#358 Signed-off-by: Daniel González Lopes <[email protected]>
Signed-off-by: Daniel González Lopes <[email protected]>
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.
It looks good to me, just two small nits.
Thanks!
Signed-off-by: dgzlopes <[email protected]>
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.
Fixed nits related with magic numbers on tests :)
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.
Thanks so much for tackling this. Just one change requested, the rest looks good!
# TODO: status is missing: | ||
# https://github.com/open-telemetry/opentelemetry-python/issues/98 | ||
if tags is None: | ||
tags = [] |
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.
It might be easier to change _extract_tags
to always return an empty list, rather than checking this here
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.
And in fact we probably should since the only other place where it's used also ends up doing some juggling around this:
opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py
Lines 239 to 243 in ed8cbdc
fields = [] | |
if event.attributes is not None: | |
fields = _extract_tags(event.attributes) | |
fields.append( |
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.
Fixed! Added the check when span.status
wasn't mandatory, but now it makes no sense.
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.
mind updating the in _extract_logs_from_span
as well?
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.
But if we change _extract_logs_from_span
to return an empty list when a span has no logs tests break because they expect logs to be None. I think that it's the same with refs.
# Example output form tests
Span([348 chars]Double=None, vBool=None, vLong=None, vBinary=None)], logs=[])
Span([348 chars]Double=None, vBool=None, vLong=None, vBinary=None)], logs=None)
Maybe I'm misunderstanding something. What do you think?
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.
Sorry, I meant to update the code in _extract_logs_from_span
to take advantage of this new empty list from _extract_tags
, lines 239 and 240 are no longer needed:
opentelemetry-python/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py
Lines 239 to 243 in ed8cbdc
fields = [] | |
if event.attributes is not None: | |
fields = _extract_tags(event.attributes) | |
fields.append( |
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.
Oh, okay! It should be updated now.
Signed-off-by: dgzlopes <[email protected]>
Signed-off-by: Daniel González Lopes <[email protected]>
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.
Looks good to me.
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.
Thanks for the PR, it looks good to me.
Just pushed a commit to update the changelog for it.
Signed-off-by: Daniel González Lopes [email protected]