Documentation
¶
Index ¶
Constants ¶
const Version = ""
The version of the orchestrion binary used to build the current binary, or blank if the current binary was not built using orchestrion.
Variables ¶
This section is empty.
Functions ¶
func CtxWithValue ¶
CtxWithValue runs context.WithValue, adds the result to the GLS slot of orchestrion, and returns it. If orchestrion is not enabled, it will run context.WithValue and return the result. Since we don't support cross-goroutine switch of the GLS we still run context.WithValue in the case we are switching goroutines.
func Enabled ¶
func Enabled() bool
Enabled returns whether the current build was compiled with orchestrion or not.
func GLSPopFunc ¶
func GLSPopFunc(key any) func()
GLSPopFunc returns a function that pops key from the GLS context stack of the goroutine that called GLSPopFunc. The returned function is safe to call from any goroutine: it compares the current goroutine's GLS contextStack pointer with the one captured at creation time and only pops if they match (i.e., same goroutine). On a different goroutine the pop is a no-op, preventing accidental corruption of another goroutine's GLS state.
func GLSPopValue ¶
GLSPopValue pops the value from the GLS slot of orchestrion and returns it. Using context.Context values usually does not require to pop any stack because the copy of each previous context makes the local variable in the scope disappear when the current function ends. But the GLS is a semi-global variable that can be accessed from any function in the stack, so we need to pop the value when we are done with it.
func GLSStackDepth ¶
func GLSStackDepth() int
GLSStackDepth returns the total number of entries in the current goroutine's GLS context stack. Returns 0 if orchestrion is not enabled. This is intended for use in tests to detect GLS leaks.
func MockGLS ¶
func MockGLS() func()
MockGLS sets up a mock GLS for testing and returns a cleanup function that restores the original state. It enables orchestrion and configures a fresh contextStack accessible via the standard getDDGLS/setDDGLS functions.
This is intended for use by tests in packages that depend on orchestrion (e.g., internal, ddtrace/tracer). Follows the same pattern as telemetry.MockClient in internal/telemetry/globalclient.go.
Tests using MockGLS must NOT use t.Parallel, as it mutates package-level variables without synchronization.
func MockGLSPerGoroutine ¶
func MockGLSPerGoroutine() func()
MockGLSPerGoroutine sets up per-goroutine GLS isolation for testing. Unlike MockGLS which uses a single shared GLS, this mock uses goroutine IDs to give each goroutine its own independent contextStack, simulating the real orchestrion runtime behavior where each runtime.g has its own GLS slot.
This is required for tests that spawn goroutines and need to verify cross-goroutine GLS behavior (e.g., GLSPopFunc no-op on wrong goroutine).
Tests using MockGLSPerGoroutine must NOT use t.Parallel, as it mutates package-level variables without synchronization.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
This program generates the `orchestrion.tool.go` file at `./orchestrion/all` from the root of the repository, which contains the necessary directives to facilitate onboarding of orchestrion.
|
This program generates the `orchestrion.tool.go` file at `./orchestrion/all` from the root of the repository, which contains the necessary directives to facilitate onboarding of orchestrion. |