reportAttribute method

void reportAttribute(
  1. String key,
  2. Object value
)

Sets a span attribute under vunet.action.<key>. value must be a String, int, double, or bool; other types are ignored. Keys are sanitized.

Implementation

void reportAttribute(String key, Object value) {
  final span = _activeSpan();
  if (span == null) return;
  final attrKey = _actionAttrKey(key);
  if (value is String) {
    span.setAttribute(Attribute.fromString(attrKey, value));
  } else if (value is bool) {
    span.setAttribute(Attribute.fromBoolean(attrKey, value));
  } else if (value is int) {
    span.setAttribute(Attribute.fromInt(attrKey, value));
  } else if (value is double) {
    span.setAttribute(Attribute.fromDouble(attrKey, value));
  }
}