finally_ method

  1. @override
Future<void> finally_(
  1. HookContext context,
  2. EvaluationDetails? evaluationDetails, [
  3. HookHints? hints
])
override

Always executed at the end, now with evaluation details parameter

Implementation

@override
Future<void> finally_(
  HookContext context,
  EvaluationDetails? evaluationDetails, [
  HookHints? hints,
]) async {
  // Generate OpenTelemetry attributes
  final otelAttributes = evaluationDetails != null
      ? OpenTelemetryUtil.fromEvaluationDetails(
          evaluationDetails,
          providerName: providerName,
        )
      : OpenTelemetryUtil.fromHookContext(
          context,
          providerName: providerName,
        );

  // Call the telemetry callback if provided
  telemetryCallback?.call(otelAttributes);
}