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

Logger-Support-for-Instrumentation-library #1149

Merged
merged 15 commits into from
Jan 15, 2022

Conversation

esigo
Copy link
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

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%> (ø)

sdk/include/opentelemetry/sdk/logs/logger_provider.h Outdated Show resolved Hide resolved
sdk/include/opentelemetry/sdk/logs/logger_provider.h Outdated Show resolved Hide resolved
private:
// The name of this logger
std::string logger_name_;

// 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
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
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
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
Member

lalitb commented Jan 12, 2022

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

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
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
Member Author

Choose a reason for hiding this comment

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

done

CHANGELOG.md Outdated Show resolved Hide resolved
@esigo
Copy link
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