TypeScript
---
title: Axiom
description: Observability as resources — OTEL datasets, ingest tokens, monitors, notifiers, and dashboards declared next to the code that emits the data.
---
Axiom is an event and observability store for logs, traces, and
metrics. Effect already emits OpenTelemetry, and with alchemy the
receiving end is code too: datasets, ingest tokens, monitors,
notifiers, and dashboards live in the same Stack as the Workers and
Functions they observe, so a threshold change is a reviewable diff.
New here? [Set up credentials](/axiom/setup) first.
## Resources
A `Dataset` is the top-level container. Pick a `kind` per OTEL
signal — it exposes the OTLP endpoints as outputs:
```typescript
const traces = yield* Axiom.Dataset("traces", { name: "app-traces", kind: "otel:traces:v1" });
const logs = yield* Axiom.Dataset("logs", { name: "app-logs", kind: "otel:logs:v1" });
const metrics = yield* Axiom.Dataset("metrics", { name: "app-metrics", kind: "otel:metrics:v1" });
```
:::caution
Renaming a dataset or changing its `kind` is a **replacement** — the
old dataset and all its events are deleted. See
[Datasets & Ingest](/axiom/data/ingest) for details.
:::
An `ApiToken` mints a least-privilege ingest credential for your
runtime to ship with:
```typescript
const ingest = yield* Axiom.ApiToken("ingest", {
name: "prod-ingest",
datasetCapabilities: {
"app-traces": { ingest: ["create"] },
},
});
```
`Monitor` + `Notifier` turn queries into alerts — see
[Monitors & Alerting](/axiom/guides/alerting) for threshold and
anomaly monitors:
```typescript
const slack = yield* Axiom.Notifier("ops-slack", {
name: "ops-channel",
properties: {
slack: { slackUrl: process.env.SLACK_WEBHOOK_URL! },
},
});
yield* Axiom.Monitor("panics", {
name: "Service panic",
type: "MatchEvent",
aplQuery: `['app-logs'] | where message contains "panic:"`,
intervalMinutes: 1,
rangeMinutes: 1,
notifierIds: [slack.id],
});
```
Beyond alerts, `Dashboard` declares charts as code, `View` saves an
APL query as a virtual dataset, and `Annotation` marks deploys on
your charts — see [Dashboards as Code](/axiom/guides/dashboards).
`VirtualField` derives computed fields on a dataset at query time.
## Compose with your cloud
Wire the dataset's OTLP endpoints and the ingest token into your
Worker or Lambda's environment, and Effect's OpenTelemetry output
flows into Axiom with no code changes — see
[Observability](/testing/observability) for the exporter-as-a-Layer
pattern:
```typescript
vars: {
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: traces.otelTracesEndpoint,
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: logs.otelLogsEndpoint,
},
```
For a full end-to-end walkthrough — dataset, token, Worker wiring,
and a monitor on top — follow
[Observability with Axiom](/cloudflare/observability/axiom-observability).
## Reference
[Dataset](/providers/axiom/dataset) ·
[ApiToken](/providers/axiom/apitoken) ·
[Monitor](/providers/axiom/monitor) ·
[Notifier](/providers/axiom/notifier) ·
[Dashboard](/providers/axiom/dashboard) ·
[Annotation](/providers/axiom/annotation) ·
[View](/providers/axiom/view) ·
[VirtualField](/providers/axiom/virtualfield)