Core concepts
A quick mental model of how Heystack organizes your data.
Services
A service is a named piece of software that produces telemetry — your API, your worker, your Next.js app. You set the service name when you initialize the SDK:
registerHeystack({ service: "my-app" });
The service name shows up on your telemetry in the console, so use something recognizable. Match it to the app you're viewing so the data lines up.
Telemetry: traces, logs, metrics
Heystack collects three kinds of OpenTelemetry signals:
- Traces — the path of a request through your app, broken into spans. Each span records what ran, how long it took, and its status. A trace tells the story of one request end to end.
- Logs — log lines emitted during your app's work, correlated with the traces around them.
- Metrics — numeric measurements over time (counts, durations, sizes).
Together they let you go from "something's off" to "here's exactly what happened" without leaving the console.
Apps and the ingest key
In the console, your data is organized into apps. An app is a data boundary inside your workspace — telemetry is scoped per app, and you only see data for the app you're viewing.
Each app has one or more ingest keys. Backend and server-side JavaScript SDKs use server keys (sk_live_…); browser code uses a public, write-only Browser key (hs_web_…); Android and iOS use platform-specific, ingest-only mobile keys (hs_android_… and hs_ios_…). A server key never belongs in browser or app code. Your integration sends telemetry with its key, and Heystack uses it to resolve the app (app_id) the data belongs to. That's how telemetry from your running code gets attributed to the right app in the console.
Because attribution is by ingest key:
- Keep a separate key (or app) per service or environment if you want to keep their telemetry apart.
- Revoking a key stops anything using it from sending more data under that app.
- Never embed a server key in a client app. Mobile keys are public and rotatable, with privileged APIs blocked server-side.
Where Heystack sits
Heystack is the telemetry and observability plane — it receives data your app pushes to it. It is never in the caller's routing path: users call your app directly, not through Heystack.
The SDK still runs instrumentation and export code inside your app, so it uses some local CPU, memory, and network. Where a runtime provides a background-lifetime hook, the SDK hands export completion to it rather than making Heystack a gateway for the response. Other runtimes use their documented flushing pattern.
After Heystack accepts an upload, a managed queue decouples receipt from storage. This protects storage from traffic bursts, but it also means new data can take part of the batch window to appear in the console. "Never in the caller request path" is an architectural boundary, not a claim of zero overhead or zero delay.
What Heystack captures per request
Every request your app handles — an API call, a background job, a page load — carries a rich picture of what happened. Heystack captures most of this automatically from your existing traffic:
- Who — if your app identifies its users, Heystack ties the request to a user and session. You can pull up every request a specific user made, or see when a session went wrong.
- Where — the location of the client making the request, down to country, region, and city. Location enrichment is rolling out in an upcoming update.
- What — the method, route, and status code, so you can instantly tell whether a request succeeded or failed and what it was doing.
- Errors and exceptions — if something is thrown during a request, Heystack captures the error type and message alongside the request. You can filter to failed requests and jump straight to the error.
- Linked requests — one user action (a button click, a job trigger) often fans out into multiple downstream requests. Heystack records those links, so you can see which requests belong to the same logical transaction.
AI calls, whichever library sent them
AI libraries describe a model call in different formats. Heystack recognises each format and stores every call in one shape: the operation, provider, model, tokens, cost, finish reason, tools, conversation, feature, and prompt and answer text. AI & Safety therefore reads the same way whichever library your app uses.
| Format | Sent by |
|---|---|
| Heystack | @heystack/otel/workers (fetch calls to AI providers, Workers AI) |
| OpenTelemetry GenAI | AI SDK 7, OpenAI Python (-v2), the Anthropic Python SDK, Pydantic AI, AWS Bedrock, anything else that sends gen_ai.* |
Vercel AI SDK (ai.*) | AI SDK 5 and 6, and AI SDK 7 with its legacy integration |
| OpenInference | LangChain, LangGraph, LlamaIndex, OpenAI Agents SDK |
| OpenLLMetry | Traceloop's OpenAI and Anthropic instrumentations, old and current |
| LiteLLM | LiteLLM's otel callback |
| Mastra | Mastra's observability export |
| MCP | The MCP Python SDK |
| Cloudflare AI Gateway | Its OpenTelemetry export and its Logpush logs |
Three rules hold for every format:
- Each call is counted once. An agent run or step that wraps model calls is shown as a step, not as another call. A second record of the same call from another layer is set aside, so tokens and cost aren't added twice.
- Text is capped. Prompt and answer text is kept to 8,000 characters each. Read-only keys never see it.
- Missing details are flagged. If your app calls a known AI provider but sends no AI details, setup check names the provider and links to AI frameworks.
People, accounts and names
Heystack knows a person by the user id your app sends (enduser.id). That id is all it needs to group requests,
errors, visits and AI use into one person. Names are optional and come from three places, merged field by field:
- Your sign-in provider (Clerk or Supabase, connected in Settings › App › People data; see People data). This is who the person is.
- Stripe, which only adds the person's plan. A card holder's name or email never replaces a sign-in name.
- Your app: the server API, then
identify()traits from the SDK. These fill only what the providers above leave empty.
Accounts are the companies or teams your users belong to. Send heystack.account.id (or call group()) and people
are grouped into accounts, each with its own users, errors and activity.
Devices before sign-in. When someone signs in on a device Heystack has already seen, that device's earlier, anonymous activity is shown on the person's page too. Heystack keeps this link for 13 months.
Names are off until you switch them on. Each app has a "Show people's names" setting (default off). Until then every page shows user ids only. Emails are shown to organisation admins only, and read keys always get ids only (see Security).
Test traffic is left out. App Care checks and journeys are marked as synthetic and never appear as people, visits, product activity, key events or AI health. Metrics, traces and logs still include them.
Correlation: from symptom to root cause
Traces, logs, and metrics are tied together by a request identifier. Every log line your app emits during a request carries the same identifier as the trace for that request. That means:
- A metric spike leads you to the exact time window.
- The traces at that time show you the failing requests.
- Each failing request links to its logs — every line your app wrote while handling it.
You move from "something spiked" to "here's the exception and the log lines that came with it" in a few clicks, without correlating timestamps by hand.
Agents and the MCP server
Your coding agent can work with all of the above directly. Heystack exposes a hosted MCP server (https://mcp.heystack.dev/mcp) that any MCP-capable agent — Claude Code, Cursor, VS Code, Codex, Gemini CLI, Claude.ai — connects to with a single command. Through it the agent can read health, issues, traces, sessions and AI usage, build an incident dossier, manage apps and alerts, and verify that a new setup is receiving data.
A few rules keep this safe:
- An agent connection is bound to one workspace, chosen when you sign in (or fixed by the personal access token it uses). Everything it does is scoped to that workspace.
- Access follows your role and scopes: reads for everyone, writes where you allow them, and destructive actions only with your confirmation.
- Everything an agent does is audited in the console under Settings › Organisation › Audit log (admins).
- Telemetry the agent reads — span names, log lines, error messages, prompts — is treated as data, never as instructions.
See MCP server, the REST API and the agent playbooks.