SamplingContext class
Context passed to sampling functions.
Provides access to the current metadata state at SDK initialization time, allowing sampling decisions based on session attributes, user info, app environment, and other metadata.
This aligns with the Faro Web SDK's SamplingContext which provides
{ metas: Meta } to the sampler function.
Example usage:
sampler: (context) {
// Sample all beta users
if (context.meta.user?.attributes?['role'] == 'beta') {
return 1.0;
}
// Sample 10% of production sessions
if (context.meta.app?.environment == 'production') {
return 0.1;
}
return 1.0;
}
Constructors
- SamplingContext({required Meta meta})
-
Creates a sampling context with the given metadata.
const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited