Skip to content

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.

Print finished spans instead of exporting them:

Terminal window
ARONA_TELEMETRY_CONSOLE=true pnpm dev

Console spans are indented and include duration and attributes. They replace the OTLP trace exporter. Metrics and logs still use a configured endpoint.

Set the standard variables and provide the layer:

Terminal window
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 pnpm dev
import { 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.

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.

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.