Skip to content

Commit e6af895

Browse files
committed
refactor(library-config): reorganize Linux process context
1 parent 56dab85 commit e6af895

12 files changed

Lines changed: 1427 additions & 1390 deletions

File tree

libdd-library-config-ffi/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ bench = false
1414
[dependencies]
1515
libdd-common = { path = "../libdd-common" }
1616
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false }
17-
libdd-library-config = { path = "../libdd-library-config" }
17+
libdd-library-config = { path = "../libdd-library-config", default-features = false, features = ["process-context-writer"] }
1818
anyhow = "1.0"
1919
constcat = "0.4.1"
2020

libdd-library-config/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ crate-type = ["lib"]
1515
bench = false
1616

1717
[features]
18-
otel-thread-ctx = []
18+
default = ["process-context-reader", "process-context-writer"]
19+
otel-thread-ctx = ["process-context-writer"]
20+
process-context-reader = []
21+
process-context-writer = []
1922

2023
[dependencies]
2124
serde = { version = "1.0", features = ["derive"] }

libdd-library-config/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// SPDX-License-Identifier: Apache-2.0
33
extern crate alloc;
44

5+
#[cfg(all(
6+
target_os = "linux",
7+
any(feature = "process-context-reader", feature = "process-context-writer")
8+
))]
59
pub mod otel_process_ctx;
610
pub mod tracer_metadata;
711

libdd-library-config/src/otel_process_ctx.rs

Lines changed: 191 additions & 642 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
use core::ffi::CStr;
5+
6+
#[cfg(feature = "process-context-reader")]
7+
pub mod self_reader {
8+
pub use crate::otel_process_ctx::ProcessContextSelfReader;
9+
}
10+
11+
// Re-exported for backwards compatibility.
12+
#[cfg(feature = "process-context-writer")]
13+
#[deprecated(note = "use libdd_library_config::otel_process_ctx directly")]
14+
pub use super::{publish, unpublish};
15+
#[deprecated(note = "use libdd_library_config::otel_process_ctx directly")]
16+
pub use super::{PROCESS_CTX_VERSION, SIGNATURE};
17+
#[cfg(feature = "process-context-reader")]
18+
#[deprecated(note = "use libdd_library_config::otel_process_ctx::ProcessContextSelfReader")]
19+
pub use self_reader::ProcessContextSelfReader;
20+
21+
/// The discoverable name of the memory mapping.
22+
pub const MAPPING_NAME: &CStr = c"OTEL_CTX";

0 commit comments

Comments
 (0)