diff --git a/opentelemetry-appender-log/CHANGELOG.md b/opentelemetry-appender-log/CHANGELOG.md index 223d9a5a6f..8e562bdfab 100644 --- a/opentelemetry-appender-log/CHANGELOG.md +++ b/opentelemetry-appender-log/CHANGELOG.md @@ -2,6 +2,8 @@ ## vNext +- **BREAKING** Remove `logs_level_enabled` feature flag as the feature is not part of the specs. [#1736](https://github.com/open-telemetry/opentelemetry-rust/pull/1736/files) + ## v0.4.0 - Add log key-values as attributes [#1628](https://github.com/open-telemetry/opentelemetry-rust/pull/1628) diff --git a/opentelemetry-appender-log/Cargo.toml b/opentelemetry-appender-log/Cargo.toml index 17bf2c3049..4b2afbffd7 100644 --- a/opentelemetry-appender-log/Cargo.toml +++ b/opentelemetry-appender-log/Cargo.toml @@ -16,12 +16,10 @@ log = { workspace = true, features = ["kv", "std"]} serde = { workspace = true, optional = true, features = ["std"] } [features] -logs_level_enabled = ["opentelemetry/logs_level_enabled"] with-serde = ["log/kv_serde", "serde"] -default = ["logs_level_enabled"] [dev-dependencies] -opentelemetry_sdk = { path = "../opentelemetry-sdk", features = [ "testing", "logs_level_enabled" ] } +opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["testing", "logs"] } opentelemetry-stdout = { path = "../opentelemetry-stdout", features = ["logs"]} log = { workspace = true, features = ["kv_serde"] } tokio = { workspace = true } diff --git a/opentelemetry-appender-log/src/lib.rs b/opentelemetry-appender-log/src/lib.rs index 2ac07b45aa..e2b03e0a5f 100644 --- a/opentelemetry-appender-log/src/lib.rs +++ b/opentelemetry-appender-log/src/lib.rs @@ -89,7 +89,6 @@ //! //! This library provides the following Cargo features: //! -//! - `logs_level_enabled`: Allow users to control the log level. //! - `with-serde`: Support complex values as attributes without stringifying them. //! //! [Logs Bridge API]: https://opentelemetry.io/docs/specs/otel/logs/bridge-api/ @@ -116,12 +115,9 @@ where L: Logger + Send + Sync, { fn enabled(&self, _metadata: &Metadata) -> bool { - #[cfg(feature = "logs_level_enabled")] return self .logger .event_enabled(severity_of_level(_metadata.level()), _metadata.target()); - #[cfg(not(feature = "logs_level_enabled"))] - true } fn log(&self, record: &Record) { @@ -742,9 +738,6 @@ mod tests { // As a result of using `with_simple_exporter` while building the logger provider, // the processor used is a `SimpleLogProcessor` which has an implementation of `event_enabled` // that always returns true. - #[cfg(feature = "logs_level_enabled")] - assert!(otel_log_appender.enabled(&log::Metadata::builder().build())); - #[cfg(not(feature = "logs_level_enabled"))] assert!(otel_log_appender.enabled(&log::Metadata::builder().build())); } diff --git a/opentelemetry-appender-tracing/CHANGELOG.md b/opentelemetry-appender-tracing/CHANGELOG.md index edf820c902..be86e429c7 100644 --- a/opentelemetry-appender-tracing/CHANGELOG.md +++ b/opentelemetry-appender-tracing/CHANGELOG.md @@ -2,6 +2,8 @@ ## vNext +- **BREAKING** Remove `logs_level_enabled` feature flag as the feature is not part of the specs. [#1736](https://github.com/open-telemetry/opentelemetry-rust/pull/1736/files) + ## v0.4.0 - Removed unwanted dependency on opentelemetry-sdk. diff --git a/opentelemetry-appender-tracing/Cargo.toml b/opentelemetry-appender-tracing/Cargo.toml index 7f94e9ec0a..ce7a21aabb 100644 --- a/opentelemetry-appender-tracing/Cargo.toml +++ b/opentelemetry-appender-tracing/Cargo.toml @@ -29,11 +29,7 @@ criterion = "0.5.1" [features] experimental_metadata_attributes = ["dep:tracing-log"] -logs_level_enabled = ["opentelemetry/logs_level_enabled"] -default = ["logs_level_enabled"] - [[bench]] name = "logs" harness = false -required-features = ["logs_level_enabled"] diff --git a/opentelemetry-appender-tracing/src/layer.rs b/opentelemetry-appender-tracing/src/layer.rs index 72d9e276e9..932390fc7b 100644 --- a/opentelemetry-appender-tracing/src/layer.rs +++ b/opentelemetry-appender-tracing/src/layer.rs @@ -181,7 +181,6 @@ where self.logger.emit(log_record); } - #[cfg(feature = "logs_level_enabled")] fn event_enabled( &self, _event: &tracing_core::Event<'_>, diff --git a/opentelemetry-proto/src/proto/opentelemetry-proto b/opentelemetry-proto/src/proto/opentelemetry-proto index b3060d2104..39339ef177 160000 --- a/opentelemetry-proto/src/proto/opentelemetry-proto +++ b/opentelemetry-proto/src/proto/opentelemetry-proto @@ -1 +1 @@ -Subproject commit b3060d2104df364136d75a35779e6bd48bac449a +Subproject commit 39339ef177218cc965b8cf863d761775ec668858 diff --git a/opentelemetry-sdk/CHANGELOG.md b/opentelemetry-sdk/CHANGELOG.md index ff0fa8cdb8..0859da7ac8 100644 --- a/opentelemetry-sdk/CHANGELOG.md +++ b/opentelemetry-sdk/CHANGELOG.md @@ -28,6 +28,9 @@ asynchronously, it should clone the log data to ensure it can be safely processed without lifetime issues. +- **BREAKING** Remove `logs_level_enabled` feature flag as the feature is not part of the specs. + [#1736](https://github.com/open-telemetry/opentelemetry-rust/pull/1736/files) + - **Breaking** [1836](https://github.com/open-telemetry/opentelemetry-rust/pull/1836) `SpanProcessor::shutdown` now takes an immutable reference to self. Any reference can call shutdown on the processor. After the first call to `shutdown` the processor will not process any new spans. ## v0.23.0 diff --git a/opentelemetry-sdk/Cargo.toml b/opentelemetry-sdk/Cargo.toml index ea402f38d8..1520a4bcf9 100644 --- a/opentelemetry-sdk/Cargo.toml +++ b/opentelemetry-sdk/Cargo.toml @@ -47,7 +47,6 @@ default = ["trace", "metrics", "logs"] trace = ["opentelemetry/trace", "rand", "async-trait", "percent-encoding"] jaeger_remote_sampler = ["trace", "opentelemetry-http", "http", "serde", "serde_json", "url"] logs = ["opentelemetry/logs", "async-trait", "serde_json"] -logs_level_enabled = ["logs", "opentelemetry/logs_level_enabled"] metrics = ["opentelemetry/metrics", "glob", "async-trait"] testing = ["opentelemetry/testing", "trace", "metrics", "logs", "rt-async-std", "rt-tokio", "rt-tokio-current-thread", "tokio/macros", "tokio/rt-multi-thread"] rt-tokio = ["tokio", "tokio-stream"] diff --git a/opentelemetry-sdk/src/export/logs/mod.rs b/opentelemetry-sdk/src/export/logs/mod.rs index 9588339462..4f9675afa4 100644 --- a/opentelemetry-sdk/src/export/logs/mod.rs +++ b/opentelemetry-sdk/src/export/logs/mod.rs @@ -2,7 +2,6 @@ use crate::logs::LogRecord; use crate::Resource; use async_trait::async_trait; -#[cfg(feature = "logs_level_enabled")] use opentelemetry::logs::Severity; use opentelemetry::{ logs::{LogError, LogResult}, @@ -18,7 +17,6 @@ pub trait LogExporter: Send + Sync + Debug { async fn export<'a>(&mut self, batch: Vec>) -> LogResult<()>; /// Shuts down the exporter. fn shutdown(&mut self) {} - #[cfg(feature = "logs_level_enabled")] /// Chek if logs are enabled. fn event_enabled(&self, _level: Severity, _target: &str, _name: &str) -> bool { true diff --git a/opentelemetry-sdk/src/lib.rs b/opentelemetry-sdk/src/lib.rs index 852f0b8327..f725049e67 100644 --- a/opentelemetry-sdk/src/lib.rs +++ b/opentelemetry-sdk/src/lib.rs @@ -87,9 +87,6 @@ //! //! * `jaeger_remote_sampler`: Enables the [Jaeger remote sampler](https://www.jaegertracing.io/docs/1.53/sampling/). //! -//! For `logs` the following feature flags are available: -//! -//! * `logs_level_enabled`: control the log level //! //! Support for recording and exporting telemetry asynchronously and perform //! metrics aggregation can be added via the following flags: diff --git a/opentelemetry-sdk/src/logs/log_emitter.rs b/opentelemetry-sdk/src/logs/log_emitter.rs index d20e602ae1..9d4b528c4e 100644 --- a/opentelemetry-sdk/src/logs/log_emitter.rs +++ b/opentelemetry-sdk/src/logs/log_emitter.rs @@ -11,7 +11,6 @@ use opentelemetry::{ Context, InstrumentationLibrary, }; -#[cfg(feature = "logs_level_enabled")] use opentelemetry::logs::Severity; use std::{ @@ -274,7 +273,6 @@ impl opentelemetry::logs::Logger for Logger { } } - #[cfg(feature = "logs_level_enabled")] fn event_enabled(&self, level: Severity, target: &str) -> bool { let provider = self.provider(); @@ -351,7 +349,6 @@ mod tests { Ok(()) } - #[cfg(feature = "logs_level_enabled")] fn event_enabled(&self, _level: Severity, _target: &str, _name: &str) -> bool { true } @@ -576,7 +573,6 @@ mod tests { Ok(()) } - #[cfg(feature = "logs_level_enabled")] fn event_enabled(&self, _level: Severity, _target: &str, _name: &str) -> bool { true } diff --git a/opentelemetry-sdk/src/logs/log_processor.rs b/opentelemetry-sdk/src/logs/log_processor.rs index 34d7fbce14..97bbc31ade 100644 --- a/opentelemetry-sdk/src/logs/log_processor.rs +++ b/opentelemetry-sdk/src/logs/log_processor.rs @@ -8,7 +8,6 @@ use futures_util::{ future::{self, Either}, {pin_mut, stream, StreamExt as _}, }; -#[cfg(feature = "logs_level_enabled")] use opentelemetry::logs::Severity; use opentelemetry::{ global, @@ -62,7 +61,6 @@ pub trait LogProcessor: Send + Sync + Debug { /// After shutdown returns the log processor should stop processing any logs. /// It's up to the implementation on when to drop the LogProcessor. fn shutdown(&self) -> LogResult<()>; - #[cfg(feature = "logs_level_enabled")] /// Check if logging is enabled fn event_enabled(&self, level: Severity, target: &str, name: &str) -> bool; @@ -131,7 +129,6 @@ impl LogProcessor for SimpleLogProcessor { } } - #[cfg(feature = "logs_level_enabled")] fn event_enabled(&self, _level: Severity, _target: &str, _name: &str) -> bool { true } @@ -162,7 +159,6 @@ impl LogProcessor for BatchLogProcessor { } } - #[cfg(feature = "logs_level_enabled")] fn event_enabled(&self, _level: Severity, _target: &str, _name: &str) -> bool { true } diff --git a/opentelemetry-stdout/Cargo.toml b/opentelemetry-stdout/Cargo.toml index e139df2b9d..df020fb1fc 100644 --- a/opentelemetry-stdout/Cargo.toml +++ b/opentelemetry-stdout/Cargo.toml @@ -19,7 +19,7 @@ rust-version = "1.65" default = ["trace", "metrics", "logs"] trace = ["opentelemetry/trace", "opentelemetry_sdk/trace", "futures-util"] metrics = ["async-trait", "opentelemetry/metrics", "opentelemetry_sdk/metrics"] -logs = ["opentelemetry/logs", "opentelemetry_sdk/logs", "async-trait", "thiserror", "opentelemetry_sdk/logs_level_enabled"] +logs = ["opentelemetry/logs", "opentelemetry_sdk/logs", "async-trait", "thiserror"] [dependencies] async-trait = { workspace = true, optional = true } diff --git a/opentelemetry/CHANGELOG.md b/opentelemetry/CHANGELOG.md index 1b578d9a2e..ab0f9267d3 100644 --- a/opentelemetry/CHANGELOG.md +++ b/opentelemetry/CHANGELOG.md @@ -87,6 +87,9 @@ let tracer = provider .build(); ``` +- **BREAKING** Remove `logs_level_enabled` feature flag as the feature is not part of the specs. + [#1736](https://github.com/open-telemetry/opentelemetry-rust/pull/1736/files) + ## v0.22.0 ### Added diff --git a/opentelemetry/Cargo.toml b/opentelemetry/Cargo.toml index f9e7d9c42e..fc4f608421 100644 --- a/opentelemetry/Cargo.toml +++ b/opentelemetry/Cargo.toml @@ -36,11 +36,10 @@ trace = ["pin-project-lite"] metrics = [] testing = ["trace", "metrics"] logs = [] -logs_level_enabled = ["logs"] otel_unstable = [] [dev-dependencies] -opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["logs_level_enabled"]} # for documentation tests +opentelemetry_sdk = { path = "../opentelemetry-sdk", features=["logs", "trace", "metrics"]} # for documentation tests criterion = { version = "0.3" } rand = { workspace = true } diff --git a/opentelemetry/src/logs/logger.rs b/opentelemetry/src/logs/logger.rs index fd4e18e043..a64d47cb0b 100644 --- a/opentelemetry/src/logs/logger.rs +++ b/opentelemetry/src/logs/logger.rs @@ -2,7 +2,6 @@ use std::{borrow::Cow, sync::Arc}; use crate::{logs::LogRecord, InstrumentationLibrary, InstrumentationLibraryBuilder, KeyValue}; -#[cfg(feature = "logs_level_enabled")] use super::Severity; /// The interface for emitting [`LogRecord`]s. @@ -20,7 +19,6 @@ pub trait Logger { /// [`Context`]: crate::Context fn emit(&self, record: Self::LogRecord); - #[cfg(feature = "logs_level_enabled")] /// Check if the given log level is enabled. fn event_enabled(&self, level: Severity, target: &str) -> bool; } diff --git a/opentelemetry/src/logs/noop.rs b/opentelemetry/src/logs/noop.rs index b2b9e8ebad..a9181c5cf0 100644 --- a/opentelemetry/src/logs/noop.rs +++ b/opentelemetry/src/logs/noop.rs @@ -84,7 +84,7 @@ impl Logger for NoopLogger { NoopLogRecord {} } fn emit(&self, _record: Self::LogRecord) {} - #[cfg(feature = "logs_level_enabled")] + fn event_enabled(&self, _level: super::Severity, _target: &str) -> bool { false } diff --git a/scripts/lint.sh b/scripts/lint.sh index 2d251b75ac..6287ac5502 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -28,7 +28,7 @@ if rustup component add clippy; then -Dwarnings done - cargo_feature opentelemetry "trace,metrics,logs,logs_level_enabled,testing" + cargo_feature opentelemetry "trace,metrics,logs,testing" cargo_feature opentelemetry-otlp "default" cargo_feature opentelemetry-otlp "default,tls" diff --git a/stress/Cargo.toml b/stress/Cargo.toml index 43aa8adee7..8cead959b9 100644 --- a/stress/Cargo.toml +++ b/stress/Cargo.toml @@ -38,8 +38,8 @@ doc = false ctrlc = "3.2.5" lazy_static = "1.4.0" num_cpus = "1.15.0" -opentelemetry = { path = "../opentelemetry", features = ["metrics", "logs", "trace", "logs_level_enabled"] } -opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["metrics", "logs", "trace", "logs_level_enabled"] } +opentelemetry = { path = "../opentelemetry", features = ["metrics", "logs", "trace"] } +opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["metrics", "logs", "trace"] } opentelemetry-appender-tracing = { path = "../opentelemetry-appender-tracing"} rand = { version = "0.8.4", features = ["small_rng"] } tracing = { workspace = true, features = ["std"]}