fromHookContext static method
Creates OpenTelemetry-compatible attributes from HookContext
This is a convenience method for use in hooks when EvaluationDetails is not available.
Implementation
static OTelAttributes fromHookContext(
HookContext context, {
String? providerName,
String? reason,
}) {
return createOTelAttributes(
flagKey: context.flagKey,
value: context.result,
providerName: providerName,
reason:
reason ??
(context.error != null
? OTelFeatureFlagConstants.REASON_ERROR
: OTelFeatureFlagConstants.REASON_DEFAULT),
evaluationContext: context.evaluationContext,
);
}