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

Add resource and instrumentation library support for OStreamSpanExporter #906

Merged
merged 2 commits into from
Jul 19, 2021

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Jul 16, 2021

Changes

OStreamSpanExporter span exporter doesn't export resources and instrumentation library. This makes it difficult to debug issues related to resources/instrumentation library. This PR adds support for it.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@lalitb lalitb requested a review from a team July 16, 2021 15:36
@codecov
Copy link

codecov bot commented Jul 16, 2021

Codecov Report

Merging #906 (6971333) into main (79c4c71) will increase coverage by 0.04%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #906      +/-   ##
==========================================
+ Coverage   95.40%   95.44%   +0.04%     
==========================================
  Files         158      158              
  Lines        6717     6749      +32     
==========================================
+ Hits         6408     6441      +33     
+ Misses        309      308       -1     
Impacted Files Coverage Δ
...de/opentelemetry/exporters/ostream/span_exporter.h 100.00% <ø> (ø)
sdk/include/opentelemetry/sdk/trace/span_data.h 98.47% <91.67%> (-1.53%) ⬇️
exporters/ostream/src/span_exporter.cc 90.33% <93.34%> (+0.58%) ⬆️
exporters/ostream/test/ostream_span_test.cc 100.00% <100.00%> (ø)
sdk/src/resource/resource.cc 92.00% <0.00%> (+12.00%) ⬆️

{
if (resource_ == nullptr)
{
// this shouldn't happen as TraceProvider provides default resources
Copy link
Contributor

Choose a reason for hiding this comment

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

Add assert here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's one of the options. I just felt it's better to avoid asserting application if we can handle it gracefully. That also let us create unit-tests for ostream exporter ( which uses span-data) without depending on TracerProvider to pass the resources.

{
if (instrumentation_library_ == nullptr)
{
// this shouldn't happen as Tracer ensures there is valid default instrumentation library.
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

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.

2 participants