Share via


BaggageScope class

Context manager for baggage scope.

This class manages the lifecycle of baggage values, setting them on enter and restoring the previous context on exit.

Methods

dispose()

Manual cleanup alternative if caller isn't using using.

run<T>(() => T)

Execute a synchronous function under this baggage scope. Automatically restores previous context afterward.

Constructor Details

BaggageScope(Map<string, string>)

new BaggageScope(pairs: Map<string, string>)

Parameters

pairs

Map<string, string>

Method Details

dispose()

Manual cleanup alternative if caller isn't using using.

function dispose()

run<T>(() => T)

Execute a synchronous function under this baggage scope. Automatically restores previous context afterward.

function run<T>(fn: () => T): T

Parameters

fn

() => T

Returns

T