VuAction class

A scoped unit of work mapped to an OpenTelemetry span (Android/iOS VuAction parity).

Prefer VuTelemetry.action.withAction for synchronous work so end always runs. For async/await, use VuTelemetry.action.startAction with try/finally { end() } — Zone-local Context.attach typically survives awaits on the same Zone, but do not hop isolates without explicit context propagation.

Nested actions: call startChildAction while this action is still active. End the child before ending the parent.

When RUM is not initialized, factories return a no-op that is safe to call.

Span name is always vunet.custom.action. The action name is stored as vunet.action.name; other properties use vunet.action.<key>.

Properties

hashCode int
The hash code for this object.
no setterinherited
isNoop bool
Whether this handle is a no-op (uninitialized RUM or post-end child).
no setter
otelSpanForTesting Span?
Underlying OTel span when recording; for unit tests only.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

end() → void
Ends the action. Idempotent: detaches context, then ends the span.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reportAttribute(String key, Object value) → void
Sets a span attribute under vunet.action.<key>. value must be a String, int, double, or bool; other types are ignored. Keys are sanitized.
reportEvent(String name, {Map<String, String> attributes = const {}}) → void
Adds a span event. Attribute keys are sanitized and prefixed with vunet.action.; the event name is not.
reportValue(String key, double value) → void
Records a numeric KPI as a span attribute under vunet.action.<key> (not the OpenTelemetry Metrics API).
startChildAction(String name) VuAction
Starts a child action while this action is still active. Parent must not be ended. End the child before ending the parent.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

noop() VuAction
No-op action used when RUM is uninitialized or after an ended parent starts a child.
setRecordingEnabledForTesting(bool enabled) → void
Test-only: enable or disable recording without full native init.