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

Export span status to Jaeger #367

Merged
merged 9 commits into from
Jan 29, 2020

Conversation

dgzlopes
Copy link
Contributor

@dgzlopes dgzlopes commented Jan 16, 2020

  • Sets status tags on the Jaeger span.
  • Removes TODO from the Jaeger integration that points to a closed issue with a merged PR.

Signed-off-by: Daniel González Lopes danielgonzalezlopes@gmail.com

Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
@dgzlopes dgzlopes requested a review from a team as a code owner January 16, 2020 13:16
@codecov-io
Copy link

codecov-io commented Jan 16, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@e9a480f). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #367   +/-   ##
=========================================
  Coverage          ?   85.26%           
=========================================
  Files             ?       38           
  Lines             ?     1920           
  Branches          ?      225           
=========================================
  Hits              ?     1637           
  Misses            ?      219           
  Partials          ?       64
Impacted Files Coverage Δ
...-ext-flask/src/opentelemetry/ext/flask/__init__.py 88.88% <100%> (ø)
opentelemetry-api/src/opentelemetry/util/types.py 100% <100%> (ø)
...xt-jaeger/src/opentelemetry/ext/jaeger/__init__.py 86.54% <100%> (ø)
...emetry-sdk/src/opentelemetry/sdk/trace/__init__.py 90.94% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9a480f...ae76533. Read the comment docs.

@mauriciovasquezbernal
Copy link
Member

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?

@dgzlopes
Copy link
Contributor Author

It sounds like a good idea @mauriciovasquezbernal.

From taking a quick look at the Go client, I think that they are doing exactly that.

@mauriciovasquezbernal
Copy link
Member

@dgzlopes do you have plans to implement that? If not I'll open an issue to keep track of it.

@dgzlopes
Copy link
Contributor Author

Sure, I'm happy to implement it @mauriciovasquezbernal. Meanwhile, I'm going to change the title and the status of this pull request.

@dgzlopes dgzlopes changed the title Remove status is missing TODO [WIP] Export span status to Jaeger Jan 17, 2020
@dgzlopes
Copy link
Contributor Author

Also, from taking a closer look at the Go implementation I see that they set an "error" tag in the Jaeger span if Status.Code is not OK. Do you think we should add that tag too?

@codeboten
Copy link
Contributor

Yes! That would be awesome.

@Oberon00
Copy link
Member

I think this is something that should be defined in the spec, similar to open-telemetry/opentelemetry-specification#380

@mauriciovasquezbernal
Copy link
Member

I opened an issue in the specs repo to track it open-telemetry/opentelemetry-specification#414.

Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
@dgzlopes dgzlopes changed the title [WIP] Export span status to Jaeger Export span status to Jaeger Jan 22, 2020
@dgzlopes
Copy link
Contributor Author

dgzlopes commented Jan 22, 2020

I'm researching why Travis is failing. Locally all the test-ext-jaeger tests are passing.

Update: Now I'm able to reproduce it locally :)

Based on the changes of open-telemetry#358

Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal left a 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 <danielgonzalezlopes@gmail.com>
Copy link
Contributor Author

@dgzlopes dgzlopes left a 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 :)

Copy link
Contributor

@codeboten codeboten left a 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 = []
Copy link
Contributor

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

Copy link
Contributor

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:

fields = []
if event.attributes is not None:
fields = _extract_tags(event.attributes)
fields.append(

Copy link
Contributor Author

@dgzlopes dgzlopes Jan 22, 2020

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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:

fields = []
if event.attributes is not None:
fields = _extract_tags(event.attributes)
fields.append(

Copy link
Contributor Author

@dgzlopes dgzlopes Jan 22, 2020

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 <danielgonzalezlopes@gmail.com>
Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
Copy link
Contributor

@codeboten codeboten left a 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.

Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal left a 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.

@mauriciovasquezbernal mauriciovasquezbernal added the PR:please merge This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.) label Jan 28, 2020
@c24t c24t merged commit 3995075 into open-telemetry:master Jan 29, 2020
@c24t c24t removed the PR:please merge This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.) label Jan 29, 2020
toumorokoshi pushed a commit to toumorokoshi/opentelemetry-python that referenced this pull request Feb 17, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants