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

Remove default logger name #2316

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Nov 21, 2024

Changes

As per the specs - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/sdk.md#logger-creation

In the case where an invalid name (null or empty string) is specified, a working Logger MUST be returned as a fallback rather than returning null or throwing an exception, its name SHOULD keep the original invalid value, and a message reporting that the specified value is invalid SHOULD be logged.

So changed the implementation to create the instrumentation scope with empty name if provided and log the warning.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@lalitb lalitb requested a review from a team as a code owner November 21, 2024 02:11
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.5%. Comparing base (6ca7881) to head (09dd87f).

Files with missing lines Patch % Lines
opentelemetry-sdk/src/logs/log_emitter.rs 50.0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2316   +/-   ##
=====================================
  Coverage   79.5%   79.5%           
=====================================
  Files        123     123           
  Lines      21258   21258           
=====================================
  Hits       16907   16907           
  Misses      4351    4351           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

impl opentelemetry::logs::LoggerProvider for LoggerProvider {
type Logger = Logger;

fn logger(&self, name: impl Into<Cow<'static, str>>) -> Self::Logger {
let mut name = name.into();
let name = name.into();

if name.is_empty() {
Copy link
Member

Choose a reason for hiding this comment

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

lets add a test for this?

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