Telemetry Events Reference

Copy Markdown View Source

bb_jido emits three telemetry events. Two are :telemetry.span/3 spans (with :start, :stop, and :exception legs); one is a single counter event.

[:bb_jido, :action, :command]

Emitted for every invocation of BB.Jido.Action.Command.run/2.

[:bb_jido, :action, :command, :start]

MeasurementTypeNotes
:system_timeinteger():erlang.system_time
:monotonic_timeinteger()
MetadataTypeNotes
:robotmodule()
:commandatom()
:telemetry_span_contextreferenceprovided by :telemetry.span/3

[:bb_jido, :action, :command, :stop]

MeasurementType
:durationinteger() (native time units)
:monotonic_timeinteger()
MetadataTypeNotes
:robotmodule()
:commandatom()
:result_tag:ok | :error | :othertag of the action return
:telemetry_span_contextreference

[:bb_jido, :action, :command, :exception]

Emitted only if the action's run/2 raises rather than returns {:error, _}. Standard :telemetry.span/3 exception metadata applies.

[:bb_jido, :action, :reactor]

Same shape as :command. Metadata uses :reactor instead of :command.

MetadataType
:robotmodule()
:reactormodule()
:result_tag:ok | :error | :other (stop event only)
:telemetry_span_contextreference

[:bb_jido, :signal]

Emitted once per signal that the bridge forwards to an agent (i.e. after throttling).

MeasurementType
:count1
MetadataType
:robotmodule() | nil
:typeString.t() — the signal's type, e.g. "bb.state.transition"

Attaching handlers

:telemetry.attach_many(
  "bb_jido-logger",
  [
    [:bb_jido, :action, :command, :stop],
    [:bb_jido, :action, :reactor, :stop],
    [:bb_jido, :signal]
  ],
  &MyApp.Logger.handle/4,
  nil
)

For Prometheus-style metrics, use Telemetry.Metrics:

[
  counter("bb_jido.signal.count", tags: [:robot, :type]),
  distribution(
    "bb_jido.action.command.duration",
    unit: {:native, :millisecond},
    tags: [:robot, :command, :result_tag]
  ),
  distribution(
    "bb_jido.action.reactor.duration",
    unit: {:native, :millisecond},
    tags: [:robot, :reactor, :result_tag]
  )
]

Spans you might wish for

BB.Jido.Action.WaitForState and BB.Jido.Action.GetJointState do not currently emit spans. They're cheap (an ETS read for one, a receive loop for the other) so the noise wasn't worth it. If you need them, wrap your own action in a :telemetry.span/3 call — actions compose cleanly.