Skip to main content

instrumented_object_store/
lib.rs

1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17//
18// This product includes software developed at Datadog (https://www.datadoghq.com/) Copyright 2025 Datadog, Inc.
19
20//! # Instrumented Object Store
21//!
22//! Adds tracing instrumentation to any [Object Store](https://docs.rs/object_store/) implementation.
23//!
24//! # Features
25//!
26//! - Automatically captures spans for all storage operations (get, put, list, etc.)
27//! - Records metadata like file paths and content sizes
28//! - Captures error details when operations fail
29//! - Works with OpenTelemetry for distributed tracing
30//!
31//! # Getting Started
32//!
33//! ```rust
34//! # use object_store::{path::Path, ObjectStore, ObjectStoreExt};
35//! # use std::sync::Arc;
36//! # use instrumented_object_store::instrument_object_store;
37//! # use datafusion::execution::context::SessionContext;
38//! # use url::Url;
39//! # use object_store::Result;
40//!
41//! # async fn example() -> Result<()> {
42//! // Create your object store
43//! let store = Arc::new(object_store::local::LocalFileSystem::new());
44//!
45//! // Wrap it with instrumentation (prefix for span names)
46//! let instrumented_store = instrument_object_store(store, "local_fs");
47//!
48//! // Use directly for file operations
49//! let result = instrumented_store.get(&Path::from("path/to/file")).await?;
50//!
51//! // Or integrate with DataFusion
52//! let ctx = SessionContext::new();
53//! ctx.register_object_store(&Url::parse("file://").unwrap(), instrumented_store);
54//! # Ok(())
55//! # }
56//! ```
57//!
58//! When combined with the [`datafusion-tracing`](https://github.com/datafusion-contrib/datafusion-tracing/tree/main/datafusion-tracing)
59//! crate, this provides end-to-end visibility from query execution to storage operations.
60
61mod instrumented_object_store;
62
63pub use instrumented_object_store::instrument_object_store;