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

koushiro pushed a commit to branch extract-fastrace-layer
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit 354b78709c6e1d30c4d0f960d692fe2b08e5809a
Author: koushiro <[email protected]>
AuthorDate: Thu Dec 11 12:26:39 2025 +0800

    refactor: Split fastrace layer to new crate
---
 core/Cargo.lock                                    | 15 ++++++--
 core/Cargo.toml                                    |  3 +-
 core/core/Cargo.toml                               |  6 ----
 core/core/src/layers/mod.rs                        |  5 ---
 core/layers/fastrace/Cargo.toml                    | 41 ++++++++++++++++++++++
 .../fastrace.rs => layers/fastrace/src/lib.rs}     |  9 +++--
 core/src/lib.rs                                    |  2 ++
 7 files changed, 62 insertions(+), 19 deletions(-)

diff --git a/core/Cargo.lock b/core/Cargo.lock
index b8671c60a..e028af558 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -5485,6 +5485,7 @@ dependencies = [
  "opendal-layer-await-tree",
  "opendal-layer-capability-check",
  "opendal-layer-fastmetrics",
+ "opendal-layer-fastrace",
  "opendal-layer-metrics",
  "opendal-layer-observe-metrics-common",
  "opendal-layer-otelmetrics",
@@ -5556,8 +5557,6 @@ dependencies = [
  "dotenvy",
  "etcd-client",
  "fastpool",
- "fastrace",
- "fastrace-jaeger",
  "flume",
  "foundationdb",
  "futures",
@@ -5695,6 +5694,18 @@ dependencies = [
  "opendal-layer-observe-metrics-common",
 ]
 
+[[package]]
+name = "opendal-layer-fastrace"
+version = "0.55.0"
+dependencies = [
+ "anyhow",
+ "dotenvy",
+ "fastrace",
+ "fastrace-jaeger",
+ "opendal-core",
+ "tokio",
+]
+
 [[package]]
 name = "opendal-layer-metrics"
 version = "0.55.0"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index cae8ccce8..4a7e8a4d1 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -92,7 +92,7 @@ layers-capability-check = 
["dep:opendal-layer-capability-check"]
 layers-chaos = ["opendal-core/layers-chaos"]
 layers-dtrace = ["opendal-core/layers-dtrace"]
 layers-fastmetrics = ["dep:opendal-layer-fastmetrics"]
-layers-fastrace = ["opendal-core/layers-fastrace"]
+layers-fastrace = ["dep:opendal-layer-fastrace"]
 layers-metrics = ["dep:opendal-layer-metrics"]
 layers-mime-guess = ["opendal-core/layers-mime-guess"]
 layers-otel-metrics = ["dep:opendal-layer-otelmetrics"]
@@ -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-fastrace = { path = "layers/fastrace", 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..915f8719f 100644
--- a/core/core/Cargo.toml
+++ b/core/core/Cargo.toml
@@ -74,8 +74,6 @@ executors-tokio = ["tokio/rt"]
 layers-chaos = ["dep:rand"]
 # Enable layers mime_guess support
 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.
@@ -315,8 +313,6 @@ web-sys = { version = "0.3.77", optional = true, features = 
[
 governor = { version = "0.10.1", optional = true, features = ["std"] }
 # for layers-mime-guess
 mime_guess = { version = "2.0.5", optional = true }
-# for layers-fastrace
-fastrace = { version = "0.7.14", optional = true }
 # for layers-opentelemetry
 opentelemetry = { version = "0.31.0", optional = true }
 # for layers-tracing
@@ -336,8 +332,6 @@ web-time = { version = "1.1.0" }
 criterion = { version = "0.7", features = ["async", "async_tokio"] }
 divan = { version = "0.1" }
 dotenvy = "0.15"
-fastrace = { version = "0.7", features = ["enable"] }
-fastrace-jaeger = "0.7"
 libtest-mimic = "0.8"
 opentelemetry = { version = "0.31.0", default-features = false, features = [
   "trace",
diff --git a/core/core/src/layers/mod.rs b/core/core/src/layers/mod.rs
index 4b1012ff6..385bfb7bd 100644
--- a/core/core/src/layers/mod.rs
+++ b/core/core/src/layers/mod.rs
@@ -65,11 +65,6 @@ mod tracing;
 #[cfg(feature = "layers-tracing")]
 pub use self::tracing::TracingLayer;
 
-#[cfg(feature = "layers-fastrace")]
-mod fastrace;
-#[cfg(feature = "layers-fastrace")]
-pub use self::fastrace::FastraceLayer;
-
 #[cfg(feature = "layers-otel-trace")]
 mod oteltrace;
 #[cfg(feature = "layers-otel-trace")]
diff --git a/core/layers/fastrace/Cargo.toml b/core/layers/fastrace/Cargo.toml
new file mode 100644
index 000000000..3a409b0b7
--- /dev/null
+++ b/core/layers/fastrace/Cargo.toml
@@ -0,0 +1,41 @@
+# 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 fastrace layer"
+name = "opendal-layer-fastrace"
+
+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]
+fastrace = { version = "0.7", features = ["enable"] }
+opendal-core = { path = "../../core", version = "0.55.0", default-features = 
false, features = ["services-memory"] }
+
+[dev-dependencies]
+anyhow = "1.0"
+dotenvy = "0.15"
+fastrace-jaeger = "0.7"
+tokio = { workspace = true, features = ["rt-multi-thread"] }
diff --git a/core/core/src/layers/fastrace.rs b/core/layers/fastrace/src/lib.rs
similarity index 98%
rename from core/core/src/layers/fastrace.rs
rename to core/layers/fastrace/src/lib.rs
index fc88b6551..ae422b365 100644
--- a/core/core/src/layers/fastrace.rs
+++ b/core/layers/fastrace/src/lib.rs
@@ -20,9 +20,8 @@ use std::future::Future;
 use std::sync::Arc;
 
 use fastrace::prelude::*;
-
-use crate::raw::*;
-use crate::*;
+use opendal_core::raw::*;
+use opendal_core::*;
 
 /// Add [fastrace](https://docs.rs/fastrace/) for every operation.
 ///
@@ -31,7 +30,7 @@ use crate::*;
 /// ## Basic Setup
 ///
 /// ```no_run
-/// # use opendal_core::layers::FastraceLayer;
+/// # use opendal_layer_fastrace::FastraceLayer;
 /// # use opendal_core::services;
 /// # use opendal_core::Operator;
 /// # use opendal_core::Result;
@@ -49,7 +48,7 @@ use crate::*;
 /// ```no_run
 /// # use anyhow::Result;
 /// # use fastrace::prelude::*;
-/// # use opendal_core::layers::FastraceLayer;
+/// # use opendal_layer_fastrace::FastraceLayer;
 /// # use opendal_core::services;
 /// # use opendal_core::Operator;
 ///
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 594e9d079..1b90ed9c3 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -58,6 +58,8 @@ pub mod layers {
     pub use opendal_layer_capability_check::*;
     #[cfg(feature = "layers-fastmetrics")]
     pub use opendal_layer_fastmetrics::*;
+    #[cfg(feature = "layers-fastrace")]
+    pub use opendal_layer_fastrace::*;
     #[cfg(feature = "layers-metrics")]
     pub use opendal_layer_metrics::*;
     #[cfg(feature = "layers-otel-metrics")]

Reply via email to