Skip to content

Storage

The bucket layout as a tree, the Postgres schema with its main tables, how data is partitioned and expired, how much a million events weigh, and what is never stored.

Applies to Engine
View as Markdown
On this page
  1. The bucket
  2. What is inside an object
  3. Postgres
  4. Who gets in
  5. The ledger
  6. Problems
  7. Numbers
  8. Daily tables
  9. People and accounts
  10. Uptime, alerts, usage
  11. Releases and source maps
  12. Weekly suggestions
  13. Partitions and retention
  14. How much a million events weigh
  15. What is never stored
  16. Next

The engine keeps data in two places and nowhere else: one bucket in any S3-compatible store, and one Postgres database. This page shows exactly what is in each, down to the object names and the columns.

The bucket

Every key starts with the project id. Under it, one folder per kind of data.

Figure. The bucket of one project. Ingest writes three branches, the roll-up two, your CI one.
  1. events/: the segments, written by Ingest. Raw events, at most 2 seconds or 4 MiB each.
  2. sessions/: one session’s events, in order, one file per hour. Written by the Roll-up.
  3. replays/: replay chunks, one every 10 seconds. Written by Ingest.
  4. snapshots/: page snapshots for click maps. Written by Ingest.
  5. sourcemaps/: one folder per release. Written by your CI.
  6. parquet/: yesterday’s events, compacted. Written by the Roll-up.
Read this diagram as text

A tree drawn like a file explorer. The root is your bucket (plus storage.prefix, if you set one). Under it there is one folder per project, prj_5k2m9x4q7w1z/, and nothing is shared between projects. The project folder has six branches, each with example files; the same tree is written as text right below this figure.

The same tree as text, to copy:

Text
prj_5k2m9x4q7w1z/
├── events/production/dt=2026-03-12/hr=09/
│   ├── 20260312T091207Z-2b81e4.ndjson.gz        (1) a segment
│   └── 20260312T091216Z-7f3a9c.ndjson.gz
├── sessions/8f3a6c1e9b2d4f07a5c3e1b8d6f4a2c0/
│   └── hr=2026-03-12-10.ndjson.gz               (2) a session, one file per hour
├── replays/8f3a6c1e9b2d4f07a5c3e1b8d6f4a2c0/
│   ├── 000000.json.gz                           (3) replay chunks
│   └── 000001.json.gz
├── snapshots/production/route=checkout/dev=desktop/
│   └── 1773306724000.json.gz                    (4) a page snapshot
├── sourcemaps/4f2a91c/
│   ├── index.json                               (5) built file → its map
│   └── assets/checkout-3f9c-8d21e07b.js.map
└── parquet/production/dt=2026-03-11/
    └── events.parquet                           (6) one day, compacted
#PrefixWritten byKeyKept (default)
1events/Ingestevents/<environment>/dt=<day>/hr=<hour>/<written at>-<writer>.ndjson.gz. The day and hour are those its events happened in, in UTC, when that is at most 48 hours before they arrived (else the hour they arrived); <written at> is when it was written, so names never repeat. See Late and out-of-order events. <writer> is 6 hex characters chosen by the process, so two processes never collide.90 days (retention.events_days)
2sessions/Roll-upsessions/<sid>/hr=<day>-<hour>.ndjson.gz. Written again, whole, each time the roll-up sees new events of that session in that hour.90 days
3replays/Ingestreplays/<sid>/<seq, 6 digits>.json.gz. Sending the same seq again replaces the object. At most 720 per session.30 days (retention.replays_days)
4snapshots/Ingestsnapshots/<environment>/route=<route key>/dev=<device>/<ts>.json.gz90 days (retention.snapshots_days)
5sourcemaps/Your CI, through a link the API signssourcemaps/<release>/index.json and sourcemaps/<release>/<path>.map90 days after the release was last seen
6parquet/Roll-up, once a dayparquet/<environment>/dt=<day>/events.parquet90 days

Names are built in one place. Notice that nothing in this module takes a bare string for the project: a key cannot be built without a Scope, and the route goes through one function that makes any path safe as a key.

crates/sypnia-store/src/keys.rs
/// Builds every object key of the engine. The only place where key layout lives.
pub struct Keys<'a> {
    prefix: &'a str, // `storage.prefix`, usually empty
    scope: &'a Scope,
}

impl<'a> Keys<'a> {
    /// `<prefix>prj_…/events/production/dt=2026-03-12/hr=09/20260312T091216Z-7f3a9c.ndjson.gz`
    /// `hour`: the hour its events happened, up to 48 hours before `written`.
    pub fn segment_in(&self, hour: DateTime<Utc>, written: DateTime<Utc>, writer: WriterId) -> ObjectKey {
        ObjectKey::new(format!(
            "{}{}/events/{}/dt={}/hr={}/{}-{}.ndjson.gz",
            self.prefix,
            self.scope.project,
            self.scope.env,
            hour.format("%Y-%m-%d"),
            hour.format("%H"),
            written.format("%Y%m%dT%H%M%SZ"),
            writer, // 6 hex characters, fixed for the life of the process
        ))
    }

    /// Chunks sort by name, so a listing is already in playback order.
    pub fn replay_chunk(&self, sid: &SessionId, seq: u16) -> ObjectKey {
        ObjectKey::new(format!("{}{}/replays/{}/{:06}.json.gz", self.prefix, self.scope.project, sid, seq))
    }

    pub fn snapshot(&self, route: &Route, dev: Device, ts: i64) -> ObjectKey {
        ObjectKey::new(format!(
            "{}{}/snapshots/{}/route={}/dev={}/{}.json.gz",
            self.prefix, self.scope.project, self.scope.env, route_key(route), dev, ts,
        ))
    }
}

/// `/orders/:id` → `orders~_id`. Same rule as the system this comes from.
fn route_key(route: &Route) -> String {
    let trimmed = route.as_str().trim_start_matches('/');
    if trimmed.is_empty() {
        return "root".to_owned();
    }
    trimmed
        .chars()
        .map(|c| match c {
            ':' => '_',
            '/' => '~',
            c if c.is_ascii_alphanumeric() || matches!(c, '_' | '~' | '.' | '-') => c,
            _ => '-',
        })
        .collect()
}

What is inside an object

A segment is gzip NDJSON: one event per line, exactly as the SDK sent it after validation, plus three fields the engine writes. This is the failed call of the example, as stored:

one line of a segment
{"v":1,"type":"server_error","ts":1773311506936,"service":"shop-api","env":"production","ver":"4f2a91c","tid":"7c2e9a4b1d8f4e6a9b3c5d7e1f2a4b6c","sid":"8f3a6c1e9b2d4f07a5c3e1b8d6f4a2c0","person":{"id":"u_1042"},"account":{"id":"acc_77"},"method":"POST","path":"/api/checkout","route":"/api/checkout","name":"HTTP 400","msg":"amount is required (POST /v1/payments) in POST /api/checkout","stack":null,"digest":null,"src":"span","span":"c3d4e5f60718293a","fp":"88a44b15205cb153","prj":"prj_5k2m9x4q7w1z","rcv":1773311507519,"bid":"5d0c7a1e-93b4-4f6a-8e2d-1c7b9a3f5e60"}
Stamped fieldMeaning
prjThe project, from the ingest key. Whatever the sender put there is replaced.
rcvWhen ingest received the event, in milliseconds, by the engine’s clock.
bidThe batch_id the event arrived in. It is how a batch that arrived twice is counted once.

A per-session file starts with one header line, then the session’s events of that hour ordered by ts, each exactly as in its segment. The header lets a reader know what it has without reading the file:

first line of sessions/8f3a…a2c0/hr=2026-03-12-10.ndjson.gz
{"type":"_session","v":1,"prj":"prj_5k2m9x4q7w1z","env":"production","sid":"8f3a6c1e9b2d4f07a5c3e1b8d6f4a2c0","hour":"2026-03-12T10:00:00Z","events":14,"first_ts":1773311476000,"last_ts":1773311518230,"server_records":2,"written_at":"2026-03-12T10:35:03Z"}

A replay chunk and a page snapshot are the body the SDK sent, gzipped, stored with Content-Type: application/json and Content-Encoding: gzip so a browser can fetch them through a signed link and get JSON. The engine does not look inside: masking happened in the browser.

The Parquet file has one column per field of the event schema, 79 in all, every one optional. ts and rcv are timestamps in milliseconds, UTC; person and account are flattened to person_id, person_name, person_email, account_id and account_name; props, spans and extra, every field the engine did not know, are JSON text. It is compressed with ZSTD, in row groups of 50,000 rows. Its schema is fixed by the engine’s version, not guessed from the day’s data. The engine never reads these files. They are for you: any tool that reads Parquet can query a day of events.

Postgres

Postgres holds what a screen or an MCP call reads. Every table starts with project_id.

Figure. The main tables in four groups. The fast path owns the problems group, the roll-up owns the numbers group, and the ledger keeps both honest.
  1. projects: every other table carries its project_id.
  2. segments: the ledger. One row per segment in the Bucket, with when the Fast path scanned it and when the Roll-up counted it.
  3. problems: one row per problem. Its occurrences, hits, trace links, analyses and alerts hang from it.
  4. perf_pages_hourly: one row per hour, route and device, with a histogram instead of an average.
Read this diagram as text

Nineteen tables in four groups; a line with a crow’s foot is a one-to-many relation and lands on the column it uses. Who gets in: projects has many ingest_keys and many api_tokens. The ledger: segments has many ingest_batches; hours stands alone. Problems, written by the Fast path: problems has many problem_occurrences, problem_hits, trace_failures, analyses and alerts. Numbers, written by the Roll-up: sessions, traces, perf_pages_hourly, perf_api_hourly, clicks_daily, usage_daily and uptime_results. Two looser links cross between the last two groups: problem_hits.key points to sessions.sid, and traces.trace_id to trace_failures.trace_id.

Who gets in

migrations/0001_projects.sql
CREATE TABLE projects (
    id          text PRIMARY KEY CHECK (id ~ '^prj_[0-9a-z]{12}$'),
    slug        text NOT NULL UNIQUE,
    name        text NOT NULL,
    settings    jsonb NOT NULL DEFAULT '{}',   -- allowed origins, replay and snapshot rules, the agent's switches and language (alert thresholds: alert_rules)
    limits      jsonb NOT NULL DEFAULT '{}',   -- events, replays and (Sypnia Cloud) everything received, per month; absent or 0 = no limit
    slow_down   jsonb,                         -- written by a pass, read by ingest through its cache
    has_server  boolean NOT NULL DEFAULT false,-- has this project ever sent server events?
    created_at  timestamptz NOT NULL DEFAULT now()
);

CREATE TABLE ingest_keys (
    id                    text PRIMARY KEY,            -- key_…
    project_id            text NOT NULL REFERENCES projects ON DELETE CASCADE,
    key                   text NOT NULL UNIQUE,        -- spk_…: public by design, so stored as it is
    rate_limit_per_minute integer NOT NULL DEFAULT 600,
    revoked_at            timestamptz
);

CREATE TABLE api_tokens (
    id          text PRIMARY KEY,                      -- tok_…
    project_id  text NOT NULL REFERENCES projects ON DELETE CASCADE,
    name        text NOT NULL,
    token_hash  bytea NOT NULL UNIQUE,                 -- sha256(sps_…). The token is shown once and never stored.
    scopes      text[] NOT NULL CHECK (scopes <@ ARRAY['read', 'replay', 'ci', 'admin']),
    revoked_at  timestamptz
);

There is no users table and no organizations table. Those belong to Sypnia Cloud’s private part Cloud, in a database of its own. The engine knows projects, keys and tokens, and one root token that lives in its configuration, never in a table.

The ledger

Four small tables make every step safe to repeat and keep projects fair to each other. Aggregation explains how they are used.

migrations/0002_ledger.sql
-- One row per segment object. Written by ingest after the object exists.
CREATE TABLE segments (
    project_id   text        NOT NULL,
    key          text        NOT NULL,
    environment  text        NOT NULL,
    hour         timestamptz NOT NULL,            -- the hr= of the key
    events       integer     NOT NULL,
    bytes        integer     NOT NULL,
    batch_ids    text[]      NOT NULL,            -- the batches inside
    skipped      text[]      NOT NULL DEFAULT '{}', -- of those, the ones an earlier segment already carried
    created_at   timestamptz NOT NULL DEFAULT now(), -- when the row was written: the order of the fast path
    leased_until timestamptz,                     -- a worker is scanning it, or it waits for its next try
    attempts     integer     NOT NULL DEFAULT 0,  -- how many times it was leased
    scanned_at   timestamptz,                     -- the fast path is done with it
    rolled_at    timestamptz,                     -- the roll-up added it to the counters
    quarantined_at timestamptz,                   -- set aside after 5 failed tries; no reader takes it
    error        text,                            -- what the last failed try said
    PRIMARY KEY (project_id, key)
);
CREATE INDEX segments_unscanned ON segments (created_at) WHERE scanned_at IS NULL AND quarantined_at IS NULL;
CREATE INDEX segments_by_hour   ON segments (project_id, environment, hour);

-- When each project last had a turn in the fast path: what keeps one project from starving the others.
CREATE TABLE project_turns (
    project_id   text PRIMARY KEY,
    fast_path_at timestamptz NOT NULL
);

-- One row per batch for 48 hours: how a batch that arrives twice is counted once.
CREATE TABLE ingest_batches (
    project_id text        NOT NULL,
    batch_id   text        NOT NULL,
    segment    text        NOT NULL,
    seen_at    timestamptz NOT NULL DEFAULT now(),
    PRIMARY KEY (project_id, batch_id)
);

-- One row per project, environment and hour: the roll-up's run guard.
CREATE TABLE hours (
    project_id  text        NOT NULL,
    environment text        NOT NULL,
    hour        timestamptz NOT NULL,
    status      text        NOT NULL CHECK (status IN ('open', 'running', 'failed', 'closed')),
    events      integer     NOT NULL DEFAULT 0,
    last_run_at timestamptz,
    attempts    integer     NOT NULL DEFAULT 0,   -- failed runs in a row
    next_attempt_at timestamptz,                  -- a failed hour waits: next pass, then 1, 5, 15, 30 minutes
    error       text,
    failed_since timestamptz,                    -- when the hour started failing: «an hour failed for 30 minutes» of `state` in GET /v1/engine/status
    PRIMARY KEY (project_id, environment, hour)
);

A segment that fails five times is quarantined, and work that must happen later (the agent’s jobs, alert releases, webhook deliveries) is rows with a time on them. Both are explained on What happens when something fails, with the jobs table.

Problems

migrations/0003_problems.sql
CREATE TABLE problems (
    id            text PRIMARY KEY,                    -- prb_…
    project_id    text NOT NULL REFERENCES projects ON DELETE CASCADE,
    environment   text NOT NULL,
    fingerprint   text NOT NULL CHECK (fingerprint ~ '^[0-9a-f]{16}$'),
    slug          text NOT NULL,
    old_slugs     text[] NOT NULL DEFAULT '{}',        -- every slug it ever had keeps working
    kind          text NOT NULL CHECK (kind IN ('error', 'failed_call', 'timeout')),
    origin        text NOT NULL CHECK (origin IN ('browser', 'server')),
    status        text NOT NULL DEFAULT 'open' CHECK (status IN ('open', 'resolved', 'ignored')),
    regressed     boolean NOT NULL DEFAULT false,
    title         text NOT NULL,                       -- the technical title, as first seen
    route         text,
    first_seen    timestamptz NOT NULL,
    last_seen     timestamptz NOT NULL,
    first_release text,
    last_release  text,
    releases      text[] NOT NULL DEFAULT '{}',        -- releases it was seen in, newest last, the last 50; a `ver` not in it is a new release
    occurrences   bigint  NOT NULL DEFAULT 0,
    people        integer NOT NULL DEFAULT 0,          -- rows of problem_hits with kind 'person'
    sessions      integer NOT NULL DEFAULT 0,          -- rows of problem_hits with kind 'session'
    people_at_last_alert integer NOT NULL DEFAULT 0,   -- what «growing» is measured against
    growing_until timestamptz,
    resolved_at   timestamptz,
    resolved_by   text,
    resolved_in_release text,
    note          text,
    sample        jsonb,                               -- one full occurrence: message, stack, original stack, trace id
    symbolicated_at        timestamptz,                -- set when symbolication worked
    symbolication_tried_at timestamptz,                -- the last try; tried again every 10 minutes
    analysis      jsonb,                               -- the agent's last answer, as the API returns it
    created_at    timestamptz NOT NULL DEFAULT now(),
    UNIQUE (project_id, environment, fingerprint),
    UNIQUE (project_id, slug)
);

-- Occurrences per hour, for the timeline. Arrays are capped at 200 like in the system this comes from.
CREATE TABLE problem_occurrences (
    project_id  text        NOT NULL,
    problem_id  text        NOT NULL REFERENCES problems ON DELETE CASCADE,
    hour        timestamptz NOT NULL,
    occurrences integer     NOT NULL,
    person_keys text[]      NOT NULL DEFAULT '{}',
    session_ids text[]      NOT NULL DEFAULT '{}',
    people      integer     NOT NULL DEFAULT 0,        -- GREATEST(stored, cardinality(person_keys))
    sessions    integer     NOT NULL DEFAULT 0,
    PRIMARY KEY (project_id, problem_id, hour)
);

-- Who and which sessions a problem hit, once each. This is what makes «3 people» exact.
CREATE TABLE problem_hits (
    project_id text        NOT NULL,
    problem_id text        NOT NULL REFERENCES problems ON DELETE CASCADE,
    kind       text        NOT NULL CHECK (kind IN ('person', 'session')),
    key        text        NOT NULL,   -- person id, or `device:<did>` for someone never identified; or the session id
    first_seen timestamptz NOT NULL,
    last_seen  timestamptz NOT NULL,
    PRIMARY KEY (project_id, problem_id, kind, key)
);

people is not an estimate. Each person a problem hits is one row in problem_hits; the insert uses ON CONFLICT DO NOTHING, and the number of rows it really inserted is added to problems.people. The same person failing twice adds nothing. Session rows expire with the session; person rows stay as long as the problem, so the count never goes down.

Four more tables hang from a problem. Two are short-lived and make «one request, one problem» work (Problem grouping); two keep its history for as long as the problem exists.

migrations/0003_problems.sql
-- Which problem a trace belongs to, for 48 hours. The fast path reads it before it opens a problem.
CREATE TABLE trace_failures (
    project_id  text        NOT NULL,
    trace_id    text        NOT NULL,
    problem_id  text        NOT NULL REFERENCES problems ON DELETE CASCADE,
    span_id     text        NOT NULL,              -- the failing span that won: the deepest one
    ancestors   text[]      NOT NULL DEFAULT '{}', -- the span ids above it, nearest first, as far as the engine has seen
    span_start  timestamptz NOT NULL,              -- when that span started: breaks a tie in depth
    created_at  timestamptz NOT NULL DEFAULT now(),
    PRIMARY KEY (project_id, trace_id)
);
CREATE INDEX trace_failures_age ON trace_failures (created_at);

-- Failed browser calls that wait up to 15 seconds for their server half. Deleted when promoted.
CREATE TABLE held_failures (
    project_id  text        NOT NULL,
    trace_id    text        NOT NULL,
    span_id     text        NOT NULL,              -- the browser call's own span: one row per call
    environment text        NOT NULL,
    failure     jsonb       NOT NULL,              -- what the fast path derived from the call and the errors that follow it, not the raw lines
    segment     text        NOT NULL,              -- the segment the call arrived in
    hold_until  timestamptz NOT NULL,              -- 15 seconds after the scan
    PRIMARY KEY (project_id, trace_id, span_id)
);
CREATE INDEX held_failures_due ON held_failures (hold_until);

-- The status history: what DELETE /v1/problems/{problem} calls «the status and its history».
CREATE TABLE problem_events (
    id              bigint      GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    project_id      text        NOT NULL,
    problem_id      text        NOT NULL REFERENCES problems ON DELETE CASCADE,
    kind            text        NOT NULL CHECK (kind IN ('resolved', 'reopened', 'ignored', 'regressed')),
    at              timestamptz NOT NULL DEFAULT now(),
    actor           text,                          -- written like resolved_by; null when the engine made the move
    previous_status text        NOT NULL,          -- what problem.status_changed sends as previous_status
    release         text,                          -- resolved: the fix release, if one was given; regressed: the release it came back in
    note            text                           -- the note sent with the change, if any
);
CREATE INDEX problem_events_by_problem ON problem_events (project_id, problem_id, at);

-- One row per analysis that reached an answer. Not the context and not the answer: problems.analysis holds the last one.
CREATE TABLE analyses (
    id          bigint      GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    project_id  text        NOT NULL,
    problem_id  text        NOT NULL REFERENCES problems ON DELETE CASCADE,
    run         integer     NOT NULL,              -- 1, 2, 3…: the `runs` of the API
    status      text        NOT NULL CHECK (status IN ('ready', 'not_enough_evidence')),
    confidence  text        CHECK (confidence IN ('high', 'medium', 'low')),  -- null without a cause
    input_hash  text        NOT NULL,              -- SHA-256 of the redacted context, in hex
    provider    text        NOT NULL,
    model       text        NOT NULL,              -- as the provider named it
    calls       smallint    NOT NULL CHECK (calls BETWEEN 1 AND 3),
    tokens_in   integer     NOT NULL,              -- of every call of this analysis, added
    tokens_out  integer     NOT NULL,
    created_at  timestamptz NOT NULL DEFAULT now(),
    UNIQUE (project_id, problem_id, run)
);
CREATE INDEX analyses_by_problem ON analyses (project_id, problem_id, created_at DESC);
TableWritten byRead for
trace_failuresThe fast path, in the transaction that marks the segment as scanned. A later failure of the same trace in a deeper span takes the row over: the rule is in Problem groupingIs this browser call, or this shallower server failure, evidence of a known problem?
held_failuresThe fast path, in the same transaction. The pass that finds hold_until past looks the trace up again, counts the call as evidence or as its own problem, and deletes the row in that transactionThe 15-second hold
problem_eventsThe API, in the transaction that changes problems.status (resolved, reopened, ignored); the fast path for regressedThe timeline’s resolved, reopened, ignored and regressed markers; problem.status_changed. The other markers come from problems.first_seen (first_seen), releases (release), analyses (analysis) and, on Sypnia Cloud, its own database (pull_request)
analysesThe agent, in the transaction of step 5 of the agent’s pipelineai.max_analyses_per_problem_per_day counts today’s rows of the problem. «The same input» is the input_hash of its latest row. A job that ends dead writes no row: its error is on its jobs row and in problems.analysis

Numbers

The hourly tables keep one histogram per metric instead of the values. A histogram is an array of counters with fixed bounds, so two of them are merged by adding position by position, and a percentile is read from the array when you ask. Aggregation has the bounds and the function.

migrations/0004_numbers.sql
CREATE TABLE perf_pages_hourly (
    project_id  text        NOT NULL,
    environment text        NOT NULL,
    hour        timestamptz NOT NULL,
    route       text        NOT NULL,
    device      text        NOT NULL,          -- mobile | tablet | desktop
    views       integer NOT NULL DEFAULT 0,
    sessions    integer NOT NULL DEFAULT 0,    -- distinct sessions in the hour: exact, because the hour is re-read whole
    errors      integer NOT NULL DEFAULT 0,
    rage_clicks integer NOT NULL DEFAULT 0,
    dead_clicks integer NOT NULL DEFAULT 0,
    leaves      integer NOT NULL DEFAULT 0,    -- page_leave events
    leave_ms    bigint  NOT NULL DEFAULT 0,    -- their added `dur`: avg_seconds = leave_ms ÷ leaves
    vital_views integer NOT NULL DEFAULT 0,    -- sessions on the page that sent a core vital
    poor_views  integer NOT NULL DEFAULT 0,    -- of those, the ones with a vital rated `poor`: poor_share
    lcp_hist    integer[] NOT NULL,            -- 15 cells, milliseconds
    inp_hist    integer[] NOT NULL,            -- 15 cells
    ttfb_hist   integer[] NOT NULL,            -- 15 cells
    cls_hist    integer[] NOT NULL,            -- 10 cells
    PRIMARY KEY (project_id, environment, hour, route, device)
) PARTITION BY RANGE (hour);

CREATE TABLE perf_api_hourly (
    project_id  text        NOT NULL,
    environment text        NOT NULL,
    hour        timestamptz NOT NULL,
    method      text        NOT NULL,
    route       text        NOT NULL,
    requests        integer NOT NULL DEFAULT 0,   -- as the browser saw them
    ok              integer NOT NULL DEFAULT 0,   -- 200 to 399
    rejected        integer NOT NULL DEFAULT 0,   -- 401, 403, 404, 409, 422 and the other 4xx that are not failures
    failed          integer NOT NULL DEFAULT 0,   -- no answer, 400, 500 and above: what error_rate counts
    server_errors   integer NOT NULL DEFAULT 0,   -- the part of failed that answered 500 and above
    network_errors  integer NOT NULL DEFAULT 0,   -- the part of failed that got no answer
    dur_hist        integer[] NOT NULL,
    server_requests integer NOT NULL DEFAULT 0,   -- as the server saw them
    server_failed   integer NOT NULL DEFAULT 0,   -- a full server_request with `err` or a status of 500 and above
    timeouts        integer NOT NULL DEFAULT 0,
    db_calls        integer NOT NULL DEFAULT 0,
    db_ms           bigint  NOT NULL DEFAULT 0,
    server_dur_hist integer[] NOT NULL,
    calls           integer NOT NULL DEFAULT 0,   -- steps of each full server_request: avg_calls = calls ÷ server_requests
    calls_ms        bigint  NOT NULL DEFAULT 0,   -- their added time: avg_calls_ms
    PRIMARY KEY (project_id, environment, hour, method, route)
) PARTITION BY RANGE (hour);

-- The index of traces, one row per trace id. The spans stay in the bucket: `segments` says which objects hold them.
-- What the API's trace list returns is here, so a list never opens an object.
CREATE TABLE traces (
    project_id  text        NOT NULL,
    trace_id    text        NOT NULL,          -- 32 hex, a W3C trace id
    started_at  timestamptz NOT NULL,
    environment text        NOT NULL,
    release     text,
    name        text        NOT NULL,          -- the root span's name, usually `METHOD route`
    services    text[]      NOT NULL DEFAULT '{}', -- `browser` and every service that ran or was called
    method      text,
    route       text,
    status      integer,                       -- what the root answered; 0 when the browser got no answer
    duration_ms integer     NOT NULL,          -- from the first span's start to the last one's end, both sides
    spans       integer     NOT NULL DEFAULT 0,
    dropped_spans integer   NOT NULL DEFAULT 0,  -- past the 500 kept per trace
    failed      boolean     NOT NULL DEFAULT false,
    partial     boolean     NOT NULL DEFAULT false,  -- a full record replaces a partial one
    sid         text,
    problem_id  text,
    segments    text[]      NOT NULL,          -- the browser's half and the server's arrive in different segments
    PRIMARY KEY (project_id, started_at, trace_id)
) PARTITION BY RANGE (started_at);
-- A trace by its id alone: GET /v1/traces/{trace_id}, and the roll-up's look-up of a trace that crosses an hour.
CREATE INDEX traces_by_id ON traces (project_id, trace_id);

A trace id is in at most one row, even when its halves land in two hours: Aggregation has the rule.

The session index is one row per session, widened as more of the session arrives:

migrations/0004_numbers.sql
CREATE TABLE sessions (
    project_id  text        NOT NULL,
    sid         text        NOT NULL,          -- 32 hex, chosen by the SDK
    environment text        NOT NULL,
    started_at  timestamptz NOT NULL,
    ended_at    timestamptz NOT NULL,
    person_id   text,
    account_id  text,
    device_id   text,
    release     text,
    device      text,
    browser     text,
    os          text,
    locale      text,
    entry_route text,
    routes      text[]  NOT NULL DEFAULT '{}', -- in order of first visit, at most 50
    page_views  integer NOT NULL DEFAULT 0,
    clicks      integer NOT NULL DEFAULT 0,
    rage_clicks integer NOT NULL DEFAULT 0,
    dead_clicks integer NOT NULL DEFAULT 0,
    errors      integer NOT NULL DEFAULT 0,
    requests    integer NOT NULL DEFAULT 0,
    failed_requests integer NOT NULL DEFAULT 0,
    has_replay  boolean NOT NULL DEFAULT false,
    PRIMARY KEY (project_id, sid)
);
CREATE INDEX sessions_recent  ON sessions (project_id, environment, ended_at DESC);
CREATE INDEX sessions_person  ON sessions (project_id, person_id, ended_at DESC) WHERE person_id IS NOT NULL;
CREATE INDEX sessions_started ON sessions (project_id, environment, started_at DESC);  -- the session list filters on started_at
CREATE INDEX sessions_trouble ON sessions (project_id, environment, ended_at DESC)
    WHERE errors > 0 OR rage_clicks > 0 OR dead_clicks > 0 OR failed_requests > 0;

Daily tables

Click maps, the elements behind the vitals, custom events and form failures are counted per UTC day of their segment’s hour, the hour the events happened. They are «add» tables: the roll-up adds the new segments of each run to the stored row, under the ledger, so each segment counts once. What GET /v1/clicks, GET /v1/performance/vitals, GET /v1/custom-events and GET /v1/form-failures return is read from them.

migrations/0004_numbers.sql
-- Where people click. A cell is 1/50 of the page's width and 20 pixels of its height:
-- cell_x = floor(rx × 50) kept in 0..49, cell_y = floor(ry ÷ 20) kept in 0..32767.
CREATE TABLE clicks_daily (
    project_id  text     NOT NULL,
    environment text     NOT NULL,
    day         date     NOT NULL,
    route       text     NOT NULL,
    device      text     NOT NULL,
    cell_x      smallint NOT NULL,
    cell_y      smallint NOT NULL,
    clicks      integer  NOT NULL DEFAULT 0,
    PRIMARY KEY (project_id, environment, day, route, device, cell_x, cell_y)
) PARTITION BY RANGE (day);

-- What people click: one row per element, from clicks that carry a selector.
CREATE TABLE click_elements_daily (
    project_id  text    NOT NULL,
    environment text    NOT NULL,
    day         date    NOT NULL,
    route       text    NOT NULL,
    device      text    NOT NULL,
    selector    text    NOT NULL,
    clicks      integer NOT NULL DEFAULT 0,
    rage_clicks integer NOT NULL DEFAULT 0,
    dead_clicks integer NOT NULL DEFAULT 0,
    role        text,                          -- the most frequent role
    label       text,                          -- only by the rule of Aggregation: never for rows, cells or links to one record
    context     text,                          -- the dialog or section, by the same majority rule
    instances   integer NOT NULL DEFAULT 1,    -- list rows joined into this element
    box         jsonb,                         -- where it was at the latest click, in page pixels
    box_at      timestamptz,                   -- the time of that click: a later one replaces the box
    sample_sessions text[] NOT NULL DEFAULT '{}', -- up to 20; sessions with a rage or dead click on it first
    PRIMARY KEY (project_id, environment, day, route, device, selector)
) PARTITION BY RANGE (day);

-- The elements the browser blamed for a vital. Each hour keeps the 15 with most samples per page, device and metric.
CREATE TABLE vital_elements_daily (
    project_id  text    NOT NULL,
    environment text    NOT NULL,
    day         date    NOT NULL,
    route       text    NOT NULL,
    device      text    NOT NULL,
    metric      text    NOT NULL CHECK (metric IN ('lcp', 'inp', 'cls')),  -- TTFB has no element
    selector    text    NOT NULL,
    kind        text,                          -- LCP: image or text; INP: pointer or keyboard. The most frequent
    samples     integer NOT NULL DEFAULT 0,
    poor        integer NOT NULL DEFAULT 0,
    needs_improvement integer NOT NULL DEFAULT 0,
    hist        integer[] NOT NULL,            -- 15 cells for LCP and INP, 10 for CLS
    PRIMARY KEY (project_id, environment, day, route, device, metric, selector)
) PARTITION BY RANGE (day);

-- What your app sent with track(name, props). At most 500 names per project; a new name past that is not counted here.
CREATE TABLE custom_events_daily (
    project_id  text        NOT NULL,
    environment text        NOT NULL,
    day         date        NOT NULL,
    name        text        NOT NULL,
    count       integer     NOT NULL DEFAULT 0,
    people      integer     NOT NULL DEFAULT 0,    -- GREATEST(stored, cardinality(person_keys))
    sessions    integer     NOT NULL DEFAULT 0,    -- GREATEST(stored, cardinality(session_ids))
    person_keys text[]      NOT NULL DEFAULT '{}', -- union, capped at 200
    session_ids text[]      NOT NULL DEFAULT '{}', -- union, capped at 200
    last_seen   timestamptz NOT NULL,
    PRIMARY KEY (project_id, environment, day, name)
) PARTITION BY RANGE (day);

-- Forms the browser refused to send. Never what was typed.
CREATE TABLE form_failures_daily (
    project_id  text    NOT NULL,
    environment text    NOT NULL,
    day         date    NOT NULL,
    route       text    NOT NULL,
    field       text    NOT NULL DEFAULT '',   -- the field's label; '' when its text was masked (the API's null)
    reason      text    NOT NULL DEFAULT '',   -- the browser's reason, `valueMissing`…; '' when it gave none
    context     text,                          -- the most frequent dialog or heading
    count       integer NOT NULL DEFAULT 0,
    sessions    integer NOT NULL DEFAULT 0,    -- GREATEST(stored, cardinality(session_ids))
    session_ids text[]  NOT NULL DEFAULT '{}', -- union, capped at 200; the API's sample_sessions are taken from it
    PRIMARY KEY (project_id, environment, day, route, field, reason)
) PARTITION BY RANGE (day);

people and sessions in these tables follow problem_occurrences: exact up to 200 a day, at least 200 beyond. A count over several days adds the days, so a person active on two days counts on each.

People and accounts

The people and accounts your app named with identify(). Their activity in a range (sessions, sessions with trouble, errors, people of an account) is counted from sessions when it is asked for, so these rows only hold who they are and when they were seen.

migrations/0008_people.sql
CREATE TABLE people (
    project_id  text        NOT NULL,
    person_id   text        NOT NULL,          -- the id your app gave, at most 128 characters
    name        text,                          -- only if your app sent it
    email       text,                          -- only if your app sent it
    account_id  text,                          -- the account the person was last seen in
    first_seen  timestamptz NOT NULL,
    last_seen   timestamptz NOT NULL,
    PRIMARY KEY (project_id, person_id)
);
CREATE INDEX people_recent  ON people (project_id, last_seen DESC);
CREATE INDEX people_account ON people (project_id, account_id, last_seen DESC) WHERE account_id IS NOT NULL;

CREATE TABLE accounts (
    project_id  text        NOT NULL,
    account_id  text        NOT NULL,
    name        text,                          -- only if your app sent it
    first_seen  timestamptz NOT NULL,
    last_seen   timestamptz NOT NULL,
    PRIMARY KEY (project_id, account_id)
);
CREATE INDEX accounts_recent ON accounts (project_id, last_seen DESC);

-- One row per DELETE /v1/people/{person_id}: the 24-hour promise, kept as work with a time on it.
CREATE TABLE deletions (
    project_id      text        NOT NULL,
    person_id       text        NOT NULL,
    requested_at    timestamptz NOT NULL DEFAULT now(),
    done_by         timestamptz NOT NULL,      -- requested_at + 24 hours: what the 202 answers
    sids            text[]      NOT NULL,      -- the person's sessions; their rows of `sessions` leave at once
    status          text        NOT NULL DEFAULT 'deleting' CHECK (status IN ('deleting', 'done')),
    attempts        integer     NOT NULL DEFAULT 0,
    next_attempt_at timestamptz NOT NULL DEFAULT now(),
    leased_until    timestamptz,
    error           text,
    done_at         timestamptz,
    PRIMARY KEY (project_id, person_id, requested_at)
);
CREATE INDEX deletions_due ON deletions (next_attempt_at) WHERE status = 'deleting';

A row of people is created only by an identify event, and of accounts by an identify that names an account; any later event of the person or account widens last_seen. DELETE /v1/people/{person_id} removes the row of people, the person’s rows of sessions and problem_hits (the problem keeps its count) and writes the row of deletions, in one transaction. The work of that row, rewriting the stored objects listed on Deleting data, is retried like an hour to roll and never given up; see What happens when something fails.

Uptime, alerts, usage

migrations/0005_alerts_usage.sql
CREATE TABLE uptime_results (
    project_id text        NOT NULL,
    check_id   text        NOT NULL,           -- chk_…
    at         timestamptz NOT NULL,
    ok         boolean     NOT NULL,
    status     integer,                        -- the HTTP status, null when there was no answer
    ms         integer,
    reason     text,
    PRIMARY KEY (project_id, check_id, at)
) PARTITION BY RANGE (at);

CREATE TABLE alerts (
    id           text PRIMARY KEY,             -- alt_…
    project_id   text NOT NULL REFERENCES projects ON DELETE CASCADE,
    environment  text,                         -- null for uptime.*, usage.limit and engine.failing, which have none
    kind         text NOT NULL,                -- problem.new, problem.regressed, problem.growing, uptime.down, …
    subject_type text NOT NULL,
    subject_id   text NOT NULL,
    dedupe_key   text NOT NULL,                -- one alert per cause: `problem.new:prb_8f3k2m9x4q7w`
    title        text NOT NULL,
    created_at   timestamptz NOT NULL DEFAULT now(),
    release_by   timestamptz NOT NULL,         -- the latest moment it may leave
    released_at  timestamptz,                  -- null while it waits for the agent's sentence
    acknowledged_at timestamptz,
    acknowledged_by text,
    UNIQUE (project_id, dedupe_key)
);

-- What a project used, per day. Written by the roll-up, read by quotas and by GET /v1/usage.
CREATE TABLE usage_daily (
    project_id text    NOT NULL,
    day        date    NOT NULL,
    events     bigint  NOT NULL DEFAULT 0,     -- counted events: errors, traces, performance samples
    events_all bigint  NOT NULL DEFAULT 0,     -- every event stored, counted or not: `received` in GET /v1/usage
    replays    integer NOT NULL DEFAULT 0,     -- sessions with a recording
    analyses   integer NOT NULL DEFAULT 0,
    dropped_over_limit bigint NOT NULL DEFAULT 0,
    PRIMARY KEY (project_id, day)
);

The checks themselves, the rules that decide which alerts exist, and where alerts are sent:

migrations/0005_alerts_usage.sql
-- An uptime check and its current state. The pass runs the checks that are due.
CREATE TABLE uptime_checks (
    id               text PRIMARY KEY,         -- chk_…
    project_id       text NOT NULL REFERENCES projects ON DELETE CASCADE,
    name             text NOT NULL,
    url              text NOT NULL,
    method           text NOT NULL DEFAULT 'GET' CHECK (method IN ('GET', 'HEAD')),
    interval_seconds integer NOT NULL DEFAULT 60 CHECK (interval_seconds IN (60, 300, 900)),
    timeout_ms       integer NOT NULL DEFAULT 10000,
    expected_status  text NOT NULL DEFAULT '200-399',
    body_contains    text,
    headers          jsonb NOT NULL DEFAULT '{}', -- stored and returned as sent: not a place for secrets
    enabled          boolean NOT NULL DEFAULT true,
    status           text NOT NULL DEFAULT 'unknown' CHECK (status IN ('up', 'down', 'paused', 'unknown')),
    failures_in_row  integer NOT NULL DEFAULT 0, -- uptime.down fires when it reaches the rule's `failures`, 2 by default
    down_since       timestamptz,              -- the first failure of the current outage
    next_check_at    timestamptz NOT NULL DEFAULT now(),
    leased_until     timestamptz,              -- a worker is running it: one check is never run twice at once
    last_checked_at  timestamptz,
    last_status_code integer,
    last_response_ms integer,
    last_error       text,                     -- timeout, dns, connection_refused, tls, status_503, body_mismatch
    created_at       timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX uptime_checks_due ON uptime_checks (next_check_at) WHERE enabled;

-- The numbers of each hour of a check: the buckets of GET /v1/uptime/checks/{check_id}/results.
CREATE TABLE uptime_hourly (
    project_id text        NOT NULL,
    check_id   text        NOT NULL,
    hour       timestamptz NOT NULL,
    checks     integer     NOT NULL DEFAULT 0,
    failures   integer     NOT NULL DEFAULT 0,
    ms_total   bigint      NOT NULL DEFAULT 0,  -- for avg_ms
    ms_hist    integer[]   NOT NULL,            -- 15 cells, the latency bounds: for p95_ms
    PRIMARY KEY (project_id, check_id, hour)
) PARTITION BY RANGE (hour);

-- Each stretch of time a check was down.
CREATE TABLE uptime_incidents (
    project_id text        NOT NULL,
    check_id   text        NOT NULL,
    started_at timestamptz NOT NULL,            -- down_since
    ended_at   timestamptz,                     -- null while it is still down
    reason     text        NOT NULL,
    PRIMARY KEY (project_id, check_id, started_at)
);

-- One row per project and kind, written when a rule is changed. A kind without a row uses its defaults.
CREATE TABLE alert_rules (
    project_id   text    NOT NULL REFERENCES projects ON DELETE CASCADE,
    kind         text    NOT NULL,              -- one of the nine kinds; no kind can be added
    enabled      boolean NOT NULL DEFAULT true,
    environments text[]  NOT NULL DEFAULT '{production}', -- ignored by the kinds with no environment
    thresholds   jsonb   NOT NULL DEFAULT '{}', -- only the thresholds you changed; the others keep their defaults
    updated_at   timestamptz NOT NULL DEFAULT now(),
    PRIMARY KEY (project_id, kind)
);

-- Webhooks registered with the API. The engine-wide alerts.webhook_url is configuration, not a row.
CREATE TABLE webhooks (
    id              text PRIMARY KEY,           -- whk_…
    project_id      text NOT NULL REFERENCES projects ON DELETE CASCADE,
    url             text NOT NULL,
    events          text[] NOT NULL DEFAULT '{alert.created}',
    enabled         boolean NOT NULL DEFAULT true,
    secret          text NOT NULL,              -- whsec_…: signing needs the secret itself, so it is kept as it is
    failing_since   timestamptz,                -- the first failed delivery since the last one that worked
    disabled_reason text CHECK (disabled_reason IN ('failing')), -- set when failing_since is 3 days old
    created_at      timestamptz NOT NULL DEFAULT now()
);

-- One row per event and webhook: the delivery, its tries and how your receiver answered.
CREATE TABLE webhook_deliveries (
    id              text PRIMARY KEY,           -- dlv_…
    project_id      text NOT NULL,
    webhook_id      text REFERENCES webhooks ON DELETE CASCADE, -- null for alerts.webhook_url
    event_id        text NOT NULL,              -- evt_…: the same on every try
    event_type      text NOT NULL,
    body            jsonb NOT NULL,             -- the exact body: a retry sends it again, signed again
    status          text NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'delivered', 'failed')),
    attempts        integer NOT NULL DEFAULT 0,
    next_attempt_at timestamptz NOT NULL DEFAULT now(),  -- at once, then 1 min, 5 min, 30 min, 2 h, 6 h, 12 h
    leased_until    timestamptz,                -- 1 minute
    response_status integer,
    response_ms     integer,
    error           text,
    created_at      timestamptz NOT NULL DEFAULT now(),
    delivered_at    timestamptz,
    UNIQUE NULLS NOT DISTINCT (project_id, webhook_id, event_id)
);
CREATE INDEX webhook_deliveries_due ON webhook_deliveries (next_attempt_at) WHERE status = 'pending';
CREATE INDEX webhook_deliveries_by_webhook ON webhook_deliveries (webhook_id, created_at DESC);

An uptime result is written once: the pass inserts it into uptime_results with ON CONFLICT DO NOTHING, and only a row it really inserted adds to uptime_hourly, moves the check’s state and opens or closes an incident, in the same transaction. uptime_24h and uptime_30d are read from uptime_hourly. A webhook’s last_delivery is its latest row of webhook_deliveries.

Releases and source maps

migrations/0007_releases.sql
CREATE TABLE releases (
    project_id       text        NOT NULL REFERENCES projects ON DELETE CASCADE,
    environment      text        NOT NULL,
    version          text        NOT NULL,     -- the string your SDK sends as `ver`, at most 40 characters
    deployed_at      timestamptz,              -- as POST /v1/releases said; null for a release only learned from events
    first_seen       timestamptz,              -- the first event that carried it, by arrival: what «a later release» compares
    last_seen        timestamptz,
    commit           text,
    previous_version text,
    repository       text,
    changes          jsonb,                    -- commits and files as sent, patches only if you sent them; null when unknown
    created_at       timestamptz NOT NULL DEFAULT now(),
    PRIMARY KEY (project_id, environment, version)
);
CREATE INDEX releases_recent ON releases (project_id, environment, COALESCE(deployed_at, first_seen) DESC);

-- The maps registered for a release, and whether each arrived. sourcemaps/<release>/index.json is written from these rows.
CREATE TABLE sourcemaps (
    project_id    text        NOT NULL,
    release       text        NOT NULL,        -- maps belong to a version, not to an environment, like their folder
    url_path      text        NOT NULL,        -- the path the JavaScript file is served from
    map_key       text        NOT NULL,        -- sourcemaps/<release>/<path>.map
    map_size      bigint      NOT NULL,
    map_sha256    text        NOT NULL,        -- the same hash registered again is `skipped`
    registered_at timestamptz NOT NULL DEFAULT now(),
    arrived_at    timestamptz,                 -- the first time the engine found the object in the Bucket
    PRIMARY KEY (project_id, release, url_path)
);

A release row is created by POST /v1/releases, by a source map upload, or by the first event that carries the version. The roll-up owns first_seen and last_seen (an upsert that keeps the earliest and the latest). The fast path only reads them: when it compares releases for «came back» and meets a version with no row or no first_seen yet, that version counts as first seen now, which is what the roll-up will write minutes later. new_problems and sessions of the API are counted when asked for, from problems.first_release and sessions.release. There is no «finish» call for an upload, so arrived_at is set when the engine first finds the object: when GET …/sourcemaps checks the maps not yet seen, or when symbolication opens it.

Weekly suggestions

migrations/0009_suggestions.sql
CREATE TABLE suggestions (
    id          text PRIMARY KEY,               -- sug_…
    project_id  text NOT NULL REFERENCES projects ON DELETE CASCADE,
    environment text NOT NULL,
    week        date NOT NULL,                  -- the Monday of the week it is about
    finding     text NOT NULL,                  -- the rule and what it is about, `inp_p75:/search:desktop`
    category    text NOT NULL CHECK (category IN ('performance', 'usability', 'reliability')),
    status      text NOT NULL DEFAULT 'new' CHECK (status IN ('new', 'accepted', 'dismissed', 'done')),
    title       text NOT NULL,
    body        text NOT NULL,                  -- the API's `text`
    route       text,
    rule        text,                           -- the rule that produced it; null when it is not from a rule
    model_used  boolean NOT NULL DEFAULT false, -- a model wrote its words
    evidence    text[] NOT NULL DEFAULT '{}',
    created_at  timestamptz NOT NULL DEFAULT now(),
    UNIQUE (project_id, environment, week, finding)
);

Running a week again replaces its suggestions by finding and keeps the status a person gave them. last_run of the API is the week’s jobs row of kind suggestions.

Partitions and retention

Figure. How long each thing lives by default. Problems outlive everything else, so the engine can still say «came back» months later.
Read this diagram as text

A bar per kind of data on an axis of days that is not to scale. In Postgres: ingest_batches (the duplicate guard), 2 days; hourly and daily numbers, 400 days (retention.numbers_days); problems, with their sentence, status and daily counts, for as long as the project exists. In the Bucket: replay chunks, 30 days (retention.replays_days); raw events in segments, 90 days (retention.events_days); per-session files, 90 days, deleted with their row of the session index; page snapshots, 90 days (retention.snapshots_days); Parquet, 90 days; source maps, 90 days after the release was last seen (retention.sourcemaps_days).

Partitions. The tables that grow with time and are read by time are partitioned by month: perf_pages_hourly, perf_api_hourly, traces, uptime_results, uptime_hourly and the five daily tables. The daily job creates the partitions of the next two months and drops the ones older than the retention of what they hold: retention.numbers_days for the hourly numbers, uptime_hourly and the daily tables, retention.events_days for traces. Dropping a partition is instant and leaves nothing to vacuum. Single uptime results are kept for 7 days, a fixed number: the daily job deletes older rows of uptime_results and drops a month’s partition once it is empty. The uptime numbers of each hour are hourly numbers and follow retention.numbers_days.

The engine creates partitions itself, in plain SQL, and needs no extension. The alternative was pg_partman or pg_cron, which many managed Postgres services do not offer. sessions and problems are not partitioned: they are updated by key, and a partition key in their primary key would make every upsert name a date.

Retention. One job a day, per project:

DataHow it is removed
Segments, Parquet, snapshotsWhole dt= folders older than the limit are listed and deleted.
Per-session files, replay chunksThe job reads expired rows of sessions, deletes the two folders of each sid, then deletes the row. Replays have their own, shorter limit and are not left for the daily job: every pass of the worker finds up to 200 sessions with has_replay whose ended_at is older than retention.replays_days, by the database’s clock (a partial index, sessions_replay_expiry), deletes each one’s replays/<sid>/ folder, then sets has_replay to false.
Source mapsReleases not seen for 90 days lose their folder.
Hourly and daily numbersOld partitions are dropped.
Rows of the ledgerA segments row goes with its segment’s dt= folder. ingest_batches and trace_failures rows after 48 hours.
Held failuresNot by this job: the pass that promotes a row of held_failures deletes it, 15 seconds after it was written or at the next pass.
AlertsRows older than retention.events_days.
People and accountsRows whose last_seen is older than retention.events_days, as their sessions. A deletions row 30 days after it is done.
Webhook deliveries, finished jobsDeliveries after 30 days; jobs that are done or dead after 30 days.
Single uptime resultsAfter 7 days, as above.
Uptime incidents, weekly suggestionsRows older than retention.numbers_days.
ProblemsNever, while the project exists. Their example occurrence loses its session link when the session expires. problem_events and analyses go with their problem.
Releases, uptime checks, alert rules, webhooksNever, while the project exists, unless you delete them. A release’s sourcemaps rows go with its folder.

The job deletes by listing because retention is the engine’s rule, not the store’s. It works the same on Amazon S3, Cloudflare R2 and SeaweedFS, and it lets Sypnia Cloud give each plan its own number of days Cloud. On AWS you may add a lifecycle rule as a second guard; the template adds one for unfinished uploads only.

How much a million events weigh

These are estimates. The first row uses a figure measured on the system this engine comes from: about 16 MB of gzip NDJSON a day for 110 to 150 thousand records a day.

DataArithmeticPer million events
Segments16 MB ÷ 130,000 records ≈ 123 bytes an event, compressed≈ 125 MB
Per-session filesThe same events again, grouped by session; server records without a session are left out≤ 125 MB
ParquetNot measured. Columnar files with ZSTD are usually smaller than gzip JSON; we budget the same size until we measure it≤ 125 MB
Replay chunksMeasured there: a short recorded session is 22 chunks, 751 KB. About 7,700 sessions per million events (1,000 sessions a day at 130,000 records). With 10 % recorded from the start and every session with trouble, budget 15 %: 1,150 sessions × 0.75 MB≈ 870 MB
Page snapshotsMeasured there: 70 to 107 KB each. They grow with routes, not with eventsa few MB
Bucket, total≈ 1.2 GB, most of it replays
sessions7,700 rows × about 600 bytes, twice that with indexes≈ 10 MB
tracesOne row per request traced. At most half the events are traces, an assumption: 500,000 rows × about 250 bytes, twice that with its indexes, 0.5 KB. Estimated, not measured≤ 250 MB
Hourly numbersThey grow with routes, not events: 100 routes × 3 devices × 24 hours × about 400 bytes≈ 3 MB a day, whatever the traffic
ingest_batchesAbout 230,000 batches (30 batches per session) × about 120 bytes, kept 48 hours≈ 28 MB, temporary
Problems and the restThousands of rows at mostunder 5 MB
Postgres, total≤ 270 MB kept, most of it traces, plus ≈ 30 MB temporary

Two things can break these numbers, and both are capped. A long session can record up to 720 chunks of 200 KB, 144 MB; measured there, one recording reached 158 MB before the cap existed. And source maps are per release, not per event: measured there, one deploy of a large app is 965 maps and 109 MB.

At 1.2 GB per million events, 90 days of a project that sends a million events a month is about 3.6 GB in the bucket, and at most 0.8 GB in Postgres, kept as long as the events. Storage is not what a deployment pays for. Writes are: Deployment shapes has that arithmetic.

What is never stored

Never storedBecause
What a person typesThe SDK masks it before anything leaves the browser. The engine never receives it.
Request and response bodies, cookies, headers, query strings, URL hashesNo event has a field for them. url is a path.
IP addresses with eventsIngest uses the address for the rate limit, in memory, and does not write it to an event, an object or a row. There is no geolocation.
Raw events in PostgresRule 1 of the overview.
Replay content in PostgresA session row has has_replay and nothing else about the recording. The replay endpoint lists the session’s chunks in the Bucket and reads each one once for its times and whether it holds a full snapshot, keeping those facts in the process’s memory (up to 50,000 chunks).
An API token, the root token, the AI key, the engine’s webhook secret in plain textTokens are stored as a SHA-256 hash; the others live in the configuration and are never printed, logged or returned. The one secret in a table is a registered webhook’s whsec_…, in webhooks.secret: a signature needs the secret itself, so it cannot be a hash. It is returned once, when the webhook is created, and never logged.
Span attributes that look like secretsAttributes whose name contains authorization, cookie, password, secret or token are removed at ingest.
What was sent to the modelThe engine stores the analysis and its token counts, not the context. It can be rebuilt on request with GET /v1/problems/{problem}/context.

Names and e-mails are stored only when your app sends them with identify(). They live in people and accounts, and are deleted with DELETE /v1/people/{person_id}. See What is collected.

Next

  • Ingest

    How a segment gets written.
  • Aggregation

    How the numbers tables are filled, and what the ledger guards.
  • Deployment shapes

    What this storage costs on AWS and on your own server.
  1. The bucket
  2. What is inside an object
  3. Postgres
  4. Who gets in
  5. The ledger
  6. Problems
  7. Numbers
  8. Daily tables
  9. People and accounts
  10. Uptime, alerts, usage
  11. Releases and source maps
  12. Weekly suggestions
  13. Partitions and retention
  14. How much a million events weigh
  15. What is never stored
  16. Next

    Search pages, sections and terms