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
Definition of
runtime.g
Add blank import of
unsafe
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
All of
- Import path
runtime
- Function body
- Function declaration
- Function name
goexit1
Prepend statements produced by the following template:
getg().__dd_gls = nil
Hack tracer.SpanFromContext
All of
- Import path
gopkg.in/
DataDog/ dd-trace-go.v1/ ddtrace/ tracer - Function body
- Function declaration
- Function name
SpanFromContext
Prepend statements produced by the following template:
// Using the following synthetic imports:
import (
traceinternal "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal"
)
{{- $span := .Function.Result 0 -}}
{{- $ok := .Function.Result 1 -}}
defer func(){
if !{{ $ok }} {
return
}
switch {{ $span }}.(type) {
case traceinternal.NoopSpan, *traceinternal.NoopSpan:
{{ $ok }} = false
}
}()