This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 6841ae1f0 refactor: split tracing layer to new crate (#6962)
6841ae1f0 is described below

commit 6841ae1f02d7b0b8df95e671c8643be44db24c8b
Author: Huang Youliang <[email protected]>
AuthorDate: Thu Dec 11 15:15:51 2025 +0800

    refactor: split tracing layer to new crate (#6962)
    
    * refactor: split tracing layer to new crate
    
    * Apply suggestions from code review
    
    Co-authored-by: Qinxuan Chen <[email protected]>
    
    ---------
    
    Co-authored-by: Xuanwo <[email protected]>
    Co-authored-by: Qinxuan Chen <[email protected]>
---
 core/Cargo.lock                                    | 12 ++++++-
 core/Cargo.toml                                    |  3 +-
 core/core/Cargo.toml                               |  4 ---
 core/core/src/layers/mod.rs                        |  5 ---
 core/layers/tracing/Cargo.toml                     | 38 ++++++++++++++++++++++
 .../tracing.rs => layers/tracing/src/lib.rs}       |  8 ++---
 core/src/lib.rs                                    |  2 ++
 7 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/core/Cargo.lock b/core/Cargo.lock
index b8671c60a..d86b8fe58 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -5490,6 +5490,7 @@ dependencies = [
  "opendal-layer-otelmetrics",
  "opendal-layer-prometheus",
  "opendal-layer-prometheus-client",
+ "opendal-layer-tracing",
  "opendal-service-aliyun-drive",
  "opendal-service-azblob",
  "opendal-service-azdls",
@@ -5611,7 +5612,6 @@ dependencies = [
  "surrealdb",
  "tikv-client",
  "tokio",
- "tracing",
  "tracing-opentelemetry",
  "tracing-subscriber",
  "url",
@@ -5740,6 +5740,16 @@ dependencies = [
  "prometheus-client",
 ]
 
+[[package]]
+name = "opendal-layer-tracing"
+version = "0.55.0"
+dependencies = [
+ "futures",
+ "http 1.4.0",
+ "opendal-core",
+ "tracing",
+]
+
 [[package]]
 name = "opendal-service-aliyun-drive"
 version = "0.55.0"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index cae8ccce8..ae8e5ecfc 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -100,7 +100,7 @@ layers-otel-trace = ["opendal-core/layers-otel-trace"]
 layers-prometheus = ["dep:opendal-layer-prometheus"]
 layers-prometheus-client = ["dep:opendal-layer-prometheus-client"]
 layers-throttle = ["opendal-core/layers-throttle"]
-layers-tracing = ["opendal-core/layers-tracing"]
+layers-tracing = ["dep:opendal-layer-tracing"]
 reqwest-rustls-tls = ["opendal-core/reqwest-rustls-tls"]
 services-aliyun-drive = ["dep:opendal-service-aliyun-drive"]
 services-alluxio = ["opendal-core/services-alluxio"]
@@ -196,6 +196,7 @@ opendal-layer-otelmetrics = { path = "layers/otelmetrics", 
version = "0.55.0", o
 opendal-layer-prometheus = { path = "layers/prometheus", version = "0.55.0", 
optional = true, default-features = false }
 opendal-layer-prometheus-client = { path = "layers/prometheus-client", version 
= "0.55.0", optional = true, default-features = false }
 opendal-layer-fastmetrics = { path = "layers/fastmetrics", version = "0.55.0", 
optional = true, default-features = false }
+opendal-layer-tracing = { path = "layers/tracing", version = "0.55.0", 
optional = true, default-features = false }
 opendal-service-aliyun-drive = { path = "services/aliyun-drive", version = 
"0.55.0", optional = true, default-features = false }
 opendal-service-azblob = { path = "services/azblob", version = "0.55.0", 
optional = true, default-features = false }
 opendal-service-azdls = { path = "services/azdls", version = "0.55.0", 
optional = true, default-features = false }
diff --git a/core/core/Cargo.toml b/core/core/Cargo.toml
index 24dd72439..d13933240 100644
--- a/core/core/Cargo.toml
+++ b/core/core/Cargo.toml
@@ -76,8 +76,6 @@ layers-chaos = ["dep:rand"]
 layers-mime-guess = ["dep:mime_guess"]
 # Enable layers fastrace support.
 layers-fastrace = ["dep:fastrace"]
-# Enable layers tracing support.
-layers-tracing = ["dep:tracing"]
 # Enable layers oteltrace support.
 layers-otel-trace = ["dep:opentelemetry", "opentelemetry/trace"]
 # Enable layers throttle support.
@@ -319,8 +317,6 @@ mime_guess = { version = "2.0.5", optional = true }
 fastrace = { version = "0.7.14", optional = true }
 # for layers-opentelemetry
 opentelemetry = { version = "0.31.0", optional = true }
-# for layers-tracing
-tracing = { version = "0.1", optional = true }
 # for layers-dtrace
 probe = { version = "0.5.1", optional = true }
 
diff --git a/core/core/src/layers/mod.rs b/core/core/src/layers/mod.rs
index 4b1012ff6..6fee599e1 100644
--- a/core/core/src/layers/mod.rs
+++ b/core/core/src/layers/mod.rs
@@ -60,11 +60,6 @@ mod tail_cut;
 pub use self::tail_cut::TailCutLayer;
 pub use self::tail_cut::TailCutLayerBuilder;
 
-#[cfg(feature = "layers-tracing")]
-mod tracing;
-#[cfg(feature = "layers-tracing")]
-pub use self::tracing::TracingLayer;
-
 #[cfg(feature = "layers-fastrace")]
 mod fastrace;
 #[cfg(feature = "layers-fastrace")]
diff --git a/core/layers/tracing/Cargo.toml b/core/layers/tracing/Cargo.toml
new file mode 100644
index 000000000..b8f9b7383
--- /dev/null
+++ b/core/layers/tracing/Cargo.toml
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[package]
+description = "Apache OpenDAL tracing layer"
+name = "opendal-layer-tracing"
+
+authors = { workspace = true }
+edition = { workspace = true }
+homepage = { workspace = true }
+license = { workspace = true }
+repository = { workspace = true }
+rust-version = { workspace = true }
+version = { workspace = true }
+
+[package.metadata.docs.rs]
+all-features = true
+
+[dependencies]
+opendal-core = { path = "../../core", version = "0.55.0", default-features = 
false }
+
+futures = { workspace = true }
+http = { workspace = true }
+tracing = "0.1"
diff --git a/core/core/src/layers/tracing.rs b/core/layers/tracing/src/lib.rs
similarity index 98%
rename from core/core/src/layers/tracing.rs
rename to core/layers/tracing/src/lib.rs
index 1e6a7b178..e7fadf54f 100644
--- a/core/core/src/layers/tracing.rs
+++ b/core/layers/tracing/src/lib.rs
@@ -26,8 +26,8 @@ use tracing::Level;
 use tracing::Span;
 use tracing::span;
 
-use crate::raw::*;
-use crate::*;
+use opendal_core::raw::*;
+use opendal_core::*;
 
 /// Add [tracing](https://docs.rs/tracing/) for every operation.
 ///
@@ -36,7 +36,7 @@ use crate::*;
 /// ## Basic Setup
 ///
 /// ```no_run
-/// # use opendal_core::layers::TracingLayer;
+/// # use opendal_layer_tracing::TracingLayer;
 /// # use opendal_core::services;
 /// # use opendal_core::Operator;
 /// # use opendal_core::Result;
@@ -53,7 +53,7 @@ use crate::*;
 ///
 /// ```no_run
 /// # use anyhow::Result;
-/// # use opendal_core::layers::TracingLayer;
+/// # use opendal_layer_tracing::TracingLayer;
 /// # use opendal_core::services;
 /// # use opendal_core::Operator;
 /// # use opentelemetry::KeyValue;
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 594e9d079..abd36b34e 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -66,4 +66,6 @@ pub mod layers {
     pub use opendal_layer_prometheus::*;
     #[cfg(feature = "layers-prometheus-client")]
     pub use opendal_layer_prometheus_client::*;
+    #[cfg(feature = "layers-tracing")]
+    pub use opendal_layer_tracing::*;
 }

Reply via email to