Skip to content

Commit

Permalink
changes for filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Sep 19, 2024
1 parent bbfc03c commit e5260d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion opentelemetry-appender-tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ opentelemetry = { version = "0.25", path = "../opentelemetry", features = ["logs
tracing = { workspace = true, features = ["std"]}
tracing-core = { workspace = true }
tracing-log = { version = "0.2", optional = true }
tracing-subscriber = { workspace = true, features = ["registry", "std", "fmt", "ansi"] }
tracing-subscriber = { workspace = true, features = ["registry", "std", "fmt", "ansi", "env-filter"] }

[dev-dependencies]
log = { workspace = true }
Expand Down
7 changes: 7 additions & 0 deletions opentelemetry-sdk/src/logs/log_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ impl opentelemetry::logs::LoggerProvider for LoggerProvider {
attributes: Option<Vec<opentelemetry::KeyValue>>,
) -> Logger {
let name = name.into();
otel_info!(target: "opentelemetry-sdk", name: "logger_versioned_creation", signal: "log",
"Creating a new versioned logger with name: {:?}, version: {:?}, schema_url: {:?}, attributes: {:?}",

Check warning on line 54 in opentelemetry-sdk/src/logs/log_emitter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/logs/log_emitter.rs#L54

Added line #L54 was not covered by tests
name, version, schema_url, attributes);

let component_name = if name.is_empty() {
Cow::Borrowed(DEFAULT_COMPONENT_NAME)
Expand All @@ -73,6 +76,8 @@ impl opentelemetry::logs::LoggerProvider for LoggerProvider {
}

fn library_logger(&self, library: Arc<InstrumentationLibrary>) -> Self::Logger {
otel_info!(target: "opentelemetry-sdk", name: "logger_library_logger", signal: "log",
"Creating a library logger for library: {:?}", library);

Check warning on line 80 in opentelemetry-sdk/src/logs/log_emitter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/logs/log_emitter.rs#L80

Added line #L80 was not covered by tests
// If the provider is shutdown, new logger will refer a no-op logger provider.
if self.is_shutdown.load(Ordering::Relaxed) {
return Logger::new(library, NOOP_LOGGER_PROVIDER.clone());
Expand Down Expand Up @@ -208,6 +213,8 @@ impl Builder {
};

// invoke set_resource on all the processors
otel_debug!(target: "opentelemetry-sdk", name: "logger_provider_build", signal: "log",
"Setting resource for logger provider and applying it to processors.");

Check warning on line 217 in opentelemetry-sdk/src/logs/log_emitter.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/logs/log_emitter.rs#L217

Added line #L217 was not covered by tests
for processor in logger_provider.log_processors() {
processor.set_resource(logger_provider.resource());
}
Expand Down

0 comments on commit e5260d9

Please sign in to comment.