Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ url = { version = "2.5", default-features = false }
opentelemetry = { path = "opentelemetry" }
opentelemetry_sdk = { path = "opentelemetry-sdk" }
opentelemetry-stdout = { path = "opentelemetry-stdout" }

[workspace.lints.clippy]
all = { level = "warn", priority = 1 }
4 changes: 1 addition & 3 deletions examples/metrics-advanced/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use opentelemetry::global;
use opentelemetry::Key;
use opentelemetry::KeyValue;
use opentelemetry_sdk::metrics::{
Aggregation, Instrument, PeriodicReader, SdkMeterProvider, Stream, Temporality,
};
use opentelemetry_sdk::metrics::{Aggregation, Instrument, SdkMeterProvider, Stream, Temporality};
use opentelemetry_sdk::Resource;
use std::error::Error;

Expand Down
3 changes: 1 addition & 2 deletions examples/metrics-basic/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use opentelemetry::{global, KeyValue};
use opentelemetry_sdk::error::OTelSdkError;
use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider};
use opentelemetry_sdk::metrics::SdkMeterProvider;
use opentelemetry_sdk::Resource;
use std::error::Error;
use std::vec;
Expand Down
3 changes: 3 additions & 0 deletions opentelemetry-appender-log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ opentelemetry-stdout = { path = "../opentelemetry-stdout", features = ["logs"] }
log = { workspace = true, features = ["kv_serde"] }
tokio = { workspace = true }
serde = { workspace = true, features = ["std", "derive"] }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-appender-tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ experimental_use_tracing_span_context = ["tracing-opentelemetry"]
name = "logs"
harness = false
required-features = ["spec_unstable_logs_enabled"]

[lints]
workspace = true
5 changes: 4 additions & 1 deletion opentelemetry-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ hyper-util = { workspace = true, features = ["client-legacy", "http1", "http2"],
opentelemetry = { version = "0.28", path = "../opentelemetry", features = ["trace"] }
reqwest = { workspace = true, features = ["blocking"], optional = true }
tokio = { workspace = true, features = ["time"], optional = true }
tracing = {workspace = true, optional = true}
tracing = {workspace = true, optional = true}

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-jaeger-propagator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ opentelemetry = { features = ["testing"], path = "../opentelemetry" }
[features]
default = ["internal-logs"]
internal-logs = ["tracing"]

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-otlp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ hyper-client = ["opentelemetry-http/hyper"]

# test
integration-testing = ["tonic", "prost", "tokio/full", "trace", "logs"]

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-otlp/examples/basic-otlp-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ opentelemetry-appender-tracing = { path = "../../../opentelemetry-appender-traci
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true, features = ["std"]}
tracing-subscriber = { workspace = true, features = ["env-filter","registry", "std", "fmt"] }

[lints]
workspace = true
5 changes: 4 additions & 1 deletion opentelemetry-otlp/examples/basic-otlp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ opentelemetry-otlp = { path = "../../../opentelemetry-otlp", features = ["grpc-t
tokio = { version = "1.0", features = ["full"] }
opentelemetry-appender-tracing = { path = "../../../opentelemetry-appender-tracing"}
tracing = { workspace = true, features = ["std"]}
tracing-subscriber = { workspace = true, features = ["env-filter","registry", "std", "fmt"] }
tracing-subscriber = { workspace = true, features = ["env-filter","registry", "std", "fmt"] }

[lints]
workspace = true
2 changes: 2 additions & 0 deletions opentelemetry-otlp/tests/integration_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ internal-logs = ["opentelemetry-otlp/internal-logs"]
# Keep tonic as the default client
default = ["tonic-client", "internal-logs"]

[lints]
workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub fn fetch_latest_metrics_for_scope(scope_name: &str) -> Result<Value> {
.get("scope")
.and_then(|s| s.get("name"))
.and_then(|name| name.as_str())
.map_or(false, |n| n == scope_name)
== Some(scope_name)
});

// Keep the resource only if it has any matching `ScopeMetrics`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ fn init_tracing() {
});
}

#[allow(clippy::await_holding_lock)]
pub async fn start_collector_container() -> Result<()> {
init_tracing();

Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-otlp/tests/integration_test/tests/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ mod logtests {
// Client - Tonic, Reqwest-blocking
#[test]
#[cfg(any(feature = "tonic-client", feature = "reqwest-blocking-client"))]
pub fn logs_simple_non_tokio_main_with_init_logs_inside_rt() -> Result<()> {
pub fn logs_simple_non_tokio_main_with_init_logs_inside_rt_blocking() -> Result<()> {
logs_non_tokio_helper(true, true)
}

Expand All @@ -295,7 +295,7 @@ mod logtests {
// Client - Reqwest-blocking
#[test]
#[cfg(feature = "reqwest-blocking-client")]
pub fn logs_simple_non_tokio_main_with_init_logs_outsie_rt() -> Result<()> {
pub fn logs_simple_non_tokio_main_with_init_logs_outsie_rt_blocking() -> Result<()> {
logs_non_tokio_helper(true, false)
}

Expand All @@ -320,7 +320,7 @@ mod logtests {
#[ignore] // request-blocking client does not work with tokio
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
#[cfg(feature = "reqwest-blocking-client")]
pub async fn logs_simple_tokio_multi_thread() -> Result<()> {
pub async fn logs_simple_tokio_multi_thread_blocking() -> Result<()> {
logs_tokio_helper(true, false, false).await
}

Expand Down
3 changes: 3 additions & 0 deletions opentelemetry-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@ tonic-build = { workspace = true }
prost-build = { workspace = true }
tempfile = "3.3.0"
serde_json = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ required-features = ["metrics"]
name = "log"
harness = false
required-features = ["logs"]

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-semantic-conventions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ semconv_experimental = []
[dev-dependencies]
opentelemetry = { default-features = false, path = "../opentelemetry" } # for doctests
opentelemetry_sdk = { features = ["trace"], path = "../opentelemetry-sdk" } # for doctests

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-stdout/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ tracing = { workspace = true, features = ["std"]}
tracing-subscriber = { workspace = true, features = ["registry", "std"] }
tokio = { workspace = true, features = ["full"] }
once_cell = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-zipkin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ http-body-util = { workspace = true }
hyper-util = { workspace = true, features = ["client-legacy", "http1", "tokio"] }
opentelemetry_sdk = { default-features = false, features = ["trace", "testing"], path = "../opentelemetry-sdk" }
temp-env = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ harness = false
[[bench]]
name = "anyvalue"
harness = false

[lints]
workspace = true
23 changes: 6 additions & 17 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,12 @@ cargo_feature() {
}

if rustup component add clippy; then
crates=( "opentelemetry"
"opentelemetry-http"
"opentelemetry-jaeger-propagator"
"opentelemetry-appender-log"
"opentelemetry-appender-tracing"
"opentelemetry-otlp"
"opentelemetry-prometheus"
"opentelemetry-proto"
"opentelemetry-sdk"
"opentelemetry-semantic-conventions"
"opentelemetry-stdout"
"opentelemetry-zipkin")
for crate in "${crates[@]}"; do
cargo clippy --manifest-path=$crate/Cargo.toml --all-targets --all-features -- \
`# Exit with a nonzero code if there are clippy warnings` \
-Dwarnings
done
# Exit with a nonzero code if there are clippy warnings
cargo clippy --workspace --all-targets --all-features -- -Dwarnings

# `opentelemetry-prometheus` doesn't belong to the workspace
cargo clippy --manifest-path=opentelemetry-prometheus/Cargo.toml --all-targets --all-features -- \
-Dwarnings

cargo_feature opentelemetry "trace,metrics,logs,spec_unstable_logs_enabled,testing"

Expand Down
3 changes: 3 additions & 0 deletions stress/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ futures-executor = { workspace = true }

[features]
stats = ["sysinfo"]

[lints]
workspace = true
2 changes: 1 addition & 1 deletion stress/src/metrics_histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn test_histogram_shared() {
}

fn test_histogram_per_thread() {
HISTOGRAM_PER_THREAD.with(|h| test_histogram(h));
HISTOGRAM_PER_THREAD.with(test_histogram);
}

fn test_histogram(histogram: &Histogram<u64>) {
Expand Down