Skip to content

Logger-Support-for-Instrumentation-library#1149

Merged
ThomsonTan merged 15 commits intoopen-telemetry:mainfrom
esigo:Logger-Instrumentation-library
Jan 15, 2022
Merged

Logger-Support-for-Instrumentation-library#1149
ThomsonTan merged 15 commits intoopen-telemetry:mainfrom
esigo:Logger-Instrumentation-library

Conversation

@esigo
Copy link
Copy Markdown
Member

@esigo esigo commented Dec 18, 2021

Fixes #1087 (issue)

Changes

Please provide a brief description of the changes here.

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

@esigo esigo requested a review from a team December 18, 2021 11:08
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 18, 2021

Codecov Report

Merging #1149 (892294d) into main (b8fae39) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1149      +/-   ##
==========================================
+ Coverage   93.29%   93.29%   +0.01%     
==========================================
  Files         174      174              
  Lines        6402     6404       +2     
==========================================
+ Hits         5972     5974       +2     
  Misses        430      430              
Impacted Files Coverage Δ
...k/instrumentationlibrary/instrumentation_library.h 100.00% <100.00%> (ø)
...trumentationlibrary/instrumentationlibrary_test.cc 100.00% <100.00%> (ø)

Comment thread sdk/include/opentelemetry/sdk/logs/logger_provider.h Outdated
Comment thread sdk/include/opentelemetry/sdk/logs/logger_provider.h Outdated
// The logger provider of this Logger. Uses a weak_ptr to avoid cyclic dependency issues the with
// logger provider
std::weak_ptr<LoggerProvider> logger_provider_;
std::shared_ptr<instrumentationlibrary::InstrumentationLibrary> instrumentation_library_;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand this is coming from tracer implementation, but now thinking why do store it as shared_ptr instead of unique_ptr, or as value. We are anyway passing it to exporters as reference.

*/
virtual void SetInstrumentationLibrary(
const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
&instrumentation_library) noexcept = 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need to call this method from within Logger::Log() for exporters to be able to read this. Do we plan to have it as separate PR?

Copy link
Copy Markdown
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the changes.

@lalitb
Copy link
Copy Markdown
Member

lalitb commented Jan 12, 2022

@ThomsonTan - Can you pls have a look to this PR. Thanks.

Comment thread api/test/logs/provider_test.cc Outdated
auto logger2 = tf->GetLogger("logger2", args);
std::array<nostd::string_view, 1> sv{"string"};
nostd::span<nostd::string_view> args{sv};
auto logger2 = tf->GetLogger("logger2", args, "lib_name", "", schema_url);
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.

nit: use another fake library name like opentelelemtry_library and make it consistent in all the tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Comment thread CHANGELOG.md
@esigo
Copy link
Copy Markdown
Member Author

esigo commented Jan 12, 2022

Would it be possible to rerun the CI jobs?
The failure seems to be unrelated to the PR:
Reading package lists...
E: Failed to fetch

@ThomsonTan ThomsonTan merged commit f380fcb into open-telemetry:main Jan 15, 2022
@esigo esigo deleted the Logger-Instrumentation-library branch January 15, 2022 08:02
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.

Logger: Support for Instrumentation library.

3 participants