runtime

Operations that interact with Go’s runtime system.

⚠️
This configuration introduces a way to access the Goroutine Local Storage (GLS), which is not meant to be used directly by end-users. This is intended to be used only by tracer internals to enable trace context forwarding in places where a context.Context value is not available.

GLS Access

Join Point
Definition of runtime.g
Advice
Add new field __dd_gls of type any.
Advice
Add blank import of unsafe
Advice
Introduce new declarations:
//go:linkname __dd_orchestrion_gls_get __dd_orchestrion_gls_get
var __dd_orchestrion_gls_get = func() any {
	return getg().m.curg.__dd_gls
}

//go:linkname __dd_orchestrion_gls_set __dd_orchestrion_gls_set
var __dd_orchestrion_gls_set = func(val any) {
	getg().m.curg.__dd_gls = val
}

Clear GLS slot on goroutine exit

Join Point
All of
  • Import path runtime
  • Function body
    • Function declaration
      • Function name goexit1
Advice
Prepend statements produced by the following template:
getg().__dd_gls = nil