track method
Future<void>
track(
- String trackingEventName, {
- EvaluationContext? context,
- TrackingEventDetails? trackingDetails,
Tracking API (spec Section 6) - record a tracking event Context merging follows: API → transaction → client → invocation If the provider does not support tracking, the call silently no-ops.
Implementation
Future<void> track(
String trackingEventName, {
EvaluationContext? context,
TrackingEventDetails? trackingDetails,
}) async {
_metrics.trackingEvents++;
final effectiveContext = {
..._defaultContext.attributes,
...context?.attributes ?? {},
..._transactionManager.currentContext?.effectiveAttributes ?? {},
};
try {
await _provider.track(
trackingEventName,
evaluationContext: effectiveContext,
trackingDetails: trackingDetails,
);
} catch (e) {
_logger.warning('Error sending tracking event "$trackingEventName": $e');
}
}