opentelemetry-process-context: implement process context publishing (OTEP-4719)#5337
Draft
herin049 wants to merge 5 commits into
Draft
opentelemetry-process-context: implement process context publishing (OTEP-4719)#5337herin049 wants to merge 5 commits into
herin049 wants to merge 5 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
External profilers and observability tools (such as the OpenTelemetry eBPF Profiler) operate outside the instrumented process and have no access to resource attributes configured inside OpenTelemetry SDKs. OTEP-4719 (Process Context Sharing) introduces a standard mechanism for OpenTelemetry SDKs to publish resource attributes for access by out-of-process readers
This PR introduces the
opentelemetry-process-contextpackage as a Rust backed Python extension (built with maturin/pyo3) that implements the process outlined in OTEP-4719. It publishes the SDK's resource attributes toa memory region that any external reader with access to
/proc/<pid>/mapsand/proc/<pid>/memcan discover.Python API
The introduced Python API has a very light surface area, consisting of three methods to publish, update and unpublish the process context.
Compatability
The original OTEP explicitly mentions that this functionality is Linux only. However, I have tried to implement this package in such a way that limited testing/development can be performed natively on any Posix compatible system (e.g. MacOS). However, the full functionality of OTEP-4719 is only available on Linux and Windows is explicitly not supported.
memfd_create("OTEL_CTX")->mmap(MAP_PRIVATE)mmap/proc/<pid>/mapsshowsmemfd:OTEL_CTX/proc)madvise(MADV_DONTFORK)prctl(PR_SET_VMA_ANON_NAME, "OTEL_CTX")CLOCK_BOOTTIMECLOCK_MONOTONICFixes #5291
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
TODO: Add more elaborate testing.
Does This PR Require a Contrib Repo Change?
Checklist: