Observability
Arona records spans, counters, and duration histograms for message mounts, sends
and edits, close, interactions, slash commands, Slack events, and command
reloads. Metrics use the arona.* namespace.
Local console output
Section titled “Local console output”Print finished spans instead of exporting them:
ARONA_TELEMETRY_CONSOLE=true pnpm devConsole spans are indented and include duration and attributes. They replace the OTLP trace exporter. Metrics and logs still use a configured endpoint.
OTLP export
Section titled “OTLP export”Set the standard variables and provide the layer:
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 pnpm devimport { Telemetry } from "@arona/core";
const Observability = Telemetry.layer({ endpoint: "http://localhost:4318", serviceName: "my-bot",});Telemetry.layerFromEnv reads the standard OTEL_* variables. The scaffolded
templates use it in production and the console layer in development.
Instrument your own effects
Section titled “Instrument your own effects”Use Telemetry.withSpan to get the same span and operation metrics:
import { Telemetry } from "@arona/core";
Telemetry.withSpan(program, "refresh-cache");Telemetry is a Layer. Exporters flush and close with the application Scope.
Error codes
Section titled “Error codes”Arona’s tagged errors carry optional code and repair fields. code is the
stable, machine-readable identity (session/conflict, message/send,
discord/rest-timeout, …); repair is a sentence describing what to do next.
Log or metric on code and treat the tag name and message as free to change.
| Prefix | Source |
|---|---|
session/* |
SessionStoreError, SessionNotFound, SessionConflict, … |
message/* |
MessageMountError, MessageTargetError |
discord/* |
DiscordRestError, DiscordMessageError |
slack/* |
SlackClientError, SlackRenderError, SlackHostError |
gateway/* |
GatewayError |
state-machine/* |
IllegalTransitionError |
SessionErrorCode, SessionRepair, MessageErrorCode, and MessageRepair
list the current values. The fields are optional on the schema so a custom
error can add its own; every built-in constructor supplies both. Spread
CodedErrorFields from @arona/core into a custom Schema.TaggedError to get
the same pair without redeclaring it.