With OTEP 4719 a standard mechanism was introduced to OTel that allows to publish information for external readers.
The Go documentation/API of the proposed SDK should look like this:
package processcontext // import "go.opentelemetry.io/otel/sdk/processcontext"
Package processcontext implements the SDK publishing side of the OTEL_CTX
process context mechanism (OTEP 4719).
A Publisher serializes a resource.Resource into a protobuf payload and exposes
it through a named memory-mapped region that external readers (such as OBI or eBPF
profiler) can discover via /proc/<pid>/maps.
The package is supported on Linux only. NewPublisher returns an error on other
platforms.
CONSTANTS
const MaxPayloadSize = 65536
MaxPayloadSize is the maximum size in bytes of the serialized
[ProcessContext] payload.
TYPES
type Option interface {
// Has unexported methods.
}
Option configures a Publisher.
type Publisher struct {
// Has unexported fields.
}
Publisher manages the OTEL_CTX memory-mapped region for this process.
External readers (e.g. OBI or eBPF profilers) discover and read resource
attributes via /proc/<pid>/maps.
At most one Publisher should be active per process at a time. Publisher is
safe for concurrent use.
func NewPublisher(r *resource.Resource, opts ...Option) (*Publisher, error)
NewPublisher creates a Publisher and publishes r as the initial process
context. It returns an error if the mapping cannot be created or if the
serialized payload exceeds MaxPayloadSize.
Call Publisher.Shutdown to release the mapping when done.
func (p *Publisher) Shutdown(_ context.Context) error
Shutdown zeros the timestamp (signaling the context is unavailable) and
unmaps the region. After Shutdown, calls to Update return an error.
func (p *Publisher) Update(r *resource.Resource) error
Update republishes updated resource attributes. It returns an error if the
serialized payload exceeds MaxPayloadSize or if the Publisher has been shut
down.
With OTEP 4719 a standard mechanism was introduced to OTel that allows to publish information for external readers.
The Go documentation/API of the proposed SDK should look like this: