Skip to content

Commit 1476c5e

Browse files
committed
chore: add warning about specialized ctx reader
1 parent 3e13f93 commit 1476c5e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libdd-library-config/src/otel_process_ctx.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,12 @@ pub mod linux {
493493
/// Read the process context from the current process.
494494
///
495495
/// This searches `/proc/self/maps` for an OTEL_CTX mapping and decodes its contents.
496-
pub fn read_process_context() -> anyhow::Result<MappingHeader> {
496+
///
497+
/// **CAUTION**: Note that the reader implemented in this module, as well as the helper
498+
/// functions it relies on, are specialized for tests (for example, it doesn't check for
499+
/// concurrent writers after reading the header, because we know they can't be). Do not
500+
/// extract or use as it is as a generic Rust OTel process context reader.
501+
fn read_process_context() -> anyhow::Result<MappingHeader> {
497502
let mapping_addr = find_otel_mapping()?;
498503
let header_ptr = verify_mapping_at(mapping_addr)?;
499504
// Safety: the pointer returned by `verify_mapping_at` points to an initialized header

0 commit comments

Comments
 (0)