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 logs_level_enabled feature flag #1736

Closed
wants to merge 12 commits into from
Closed
2 changes: 2 additions & 0 deletions opentelemetry-appender-log/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions opentelemetry-appender-log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
7 changes: 0 additions & 7 deletions opentelemetry-appender-log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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) {
Expand Down Expand Up @@ -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()));
}

Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-appender-tracing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions opentelemetry-appender-tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 0 additions & 1 deletion opentelemetry-appender-tracing/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ where
self.logger.emit(log_record);
}

#[cfg(feature = "logs_level_enabled")]
fn event_enabled(
&self,
_event: &tracing_core::Event<'_>,
Expand Down
3 changes: 3 additions & 0 deletions opentelemetry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion opentelemetry-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 0 additions & 2 deletions opentelemetry-sdk/src/export/logs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -18,7 +17,6 @@ pub trait LogExporter: Send + Sync + Debug {
async fn export<'a>(&mut self, batch: Vec<Cow<'a, LogData>>) -> 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
Expand Down
3 changes: 0 additions & 3 deletions opentelemetry-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions opentelemetry-sdk/src/logs/log_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use opentelemetry::{
Context, InstrumentationLibrary,
};

#[cfg(feature = "logs_level_enabled")]
use opentelemetry::logs::Severity;

use std::{
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -351,7 +349,6 @@ mod tests {
Ok(())
}

#[cfg(feature = "logs_level_enabled")]
fn event_enabled(&self, _level: Severity, _target: &str, _name: &str) -> bool {
true
}
Expand Down Expand Up @@ -576,7 +573,6 @@ mod tests {
Ok(())
}

#[cfg(feature = "logs_level_enabled")]
fn event_enabled(&self, _level: Severity, _target: &str, _name: &str) -> bool {
true
}
Expand Down
4 changes: 0 additions & 4 deletions opentelemetry-sdk/src/logs/log_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -162,7 +159,6 @@ impl<R: RuntimeChannel> LogProcessor for BatchLogProcessor<R> {
}
}

#[cfg(feature = "logs_level_enabled")]
fn event_enabled(&self, _level: Severity, _target: &str, _name: &str) -> bool {
true
}
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-stdout/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
3 changes: 3 additions & 0 deletions opentelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions opentelemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
2 changes: 0 additions & 2 deletions opentelemetry/src/logs/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/src/logs/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions stress/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]}
Expand Down
Loading