attachToObserver static method

void attachToObserver()

Attaches metrics collection to JObserver for automatic tracking.

Registers a JObserverDelegate, so it coexists with other observers and callbacks. Calling it again is a no-op; detachFromObserver unregisters it. This tracks:

  • intent.dispatched, intent.failed, intent.cancelled and intent.dropped counters, tagged by type
  • intent.execution.duration timers (microseconds) covering JIntent.onInvoke only; time spent waiting in a dispatcher queue is not included
  • state.changed and effect.emitted counters

Effect completion time is not measured.

Implementation

static void attachToObserver() {
  if (!_enabled) {
    enable();
  }
  JObserver.addObserver(_observer);
}