Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,17 @@ jobs:
bun run --filter=@maple/backend test --
src/services/warehouse/web-analytics-parity.clickhouse.e2e.test.ts

# A cascaded rollup that never fires reads as "no data", not as an error.
- name: Verify the trace facets rollup
env:
CLICKHOUSE_E2E: "1"
CLICKHOUSE_E2E_URL: http://127.0.0.1:8123
CLICKHOUSE_E2E_USER: maple
CLICKHOUSE_E2E_PASSWORD: maple
run: >-
bun run --filter=@maple/backend test --
src/services/warehouse/trace-facets-hourly-materialization.clickhouse.e2e.test.ts

local-checkpoint-native:
name: Local checkpoint native
needs: changes
Expand Down
13 changes: 13 additions & 0 deletions apps/cli/src/server/local-schema-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,19 @@ export const LOCAL_SCHEMA_HISTORY: ReadonlyArray<LocalSchemaHistoryEntry> = Obje
manifestDigest: "eac1c292f9f3d9d799d4a76a7a9991c258aaacf344d31479ebb5bf6014a6840a",
projectRevision: "ed74788ef292834069e0ea6ee3b22d68fc604fb66cb54d2d551db67ce8d20b3a",
}),
Object.freeze({
// v24 adds trace_facets_hourly and its view off trace_list_mv, backfilled
// from the retained root spans. Nothing existing is rewritten.
//
// projectRevision is carried forward deliberately: it is a hardcoded
// constant that no longer tracks the generator's header, and the identity
// this gate compares is the fingerprint/digest pair.
version: 24,
fingerprint: "35f37b2e3c43d610",
digest: "35f37b2e3c43d61046bc05f477b4e16c4f0f2ddb2c9100dc5298699014b5a047",
manifestDigest: "09eeccdbd568e6d550b739bb05e074dedb399720902b35577d4eb963c48b0a53",
projectRevision: "ed74788ef292834069e0ea6ee3b22d68fc604fb66cb54d2d551db67ce8d20b3a",
}),
] as const)

/** Immutable SQLite control DDL identities, checked by clickhouse:schema:check. */
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/server/local-schema-version.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Increment this value for every structural change to the generated local
// schema. The compatibility manifest and migration registry must be updated in
// the same change before a new value can ship.
export const LOCAL_SCHEMA_VERSION = 23 as const
export const LOCAL_SCHEMA_VERSION = 24 as const

/** SQLite eventing state has its own independent version sequence. */
export const LOCAL_CONTROL_SCHEMA_VERSION = 1 as const
34 changes: 34 additions & 0 deletions apps/cli/src/server/local-store-migrations/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1052,5 +1052,39 @@ export const LOCAL_STORE_STEPS: ReadonlyArray<StepSpec> = [
},
],
},
{
// Both objects are new; the backfill rolls up the root spans already retained.
// A resumed step re-runs afterBootstrap on the staged target, hence the truncate.
id: "local-0023-to-0024-trace-facets-hourly",
from: 23,
to: 24,
description:
"Create trace_facets_hourly and its materialized view, backfilled from trace_list_mv, so the traces sidebar facets read an hourly rollup",
clonedBefore: "any DDL runs",
afterBootstrap: [
backfill(
"TRUNCATE TABLE IF EXISTS trace_facets_hourly",
"INSERT INTO trace_facets_hourly (OrgId, Hour, ServiceName, SpanName, HttpMethod, HttpStatusCode, DeploymentEnv, ServiceNamespace, HasError, TraceCount, DurationMin, DurationMax, DurationQuantiles) SELECT OrgId, toStartOfHour(Timestamp) AS Hour, ServiceName, SpanName, HttpMethod, HttpStatusCode, DeploymentEnv, ServiceNamespace, HasError, count() AS TraceCount, min(Duration) AS DurationMin, max(Duration) AS DurationMax, quantilesTDigestState(0.5, 0.95)(Duration) AS DurationQuantiles FROM trace_list_mv GROUP BY OrgId, Hour, ServiceName, SpanName, HttpMethod, HttpStatusCode, DeploymentEnv, ServiceNamespace, HasError",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
),
],
plan: [
[
"create-trace-facets-hourly",
"Create trace_facets_hourly and trace_facets_hourly_mv via the v24 bootstrap and backfill the rollup from trace_list_mv",
],
],
verifies: "Verify the v24 physical schema and the retained raw telemetry counts",
dispositions: [
{
name: "trace_facets_hourly",
classification: "derived",
disposition: "rebuild-within-retention-horizon",
guarantee: "Rebuilt from every root span trace_list_mv retains; both keep 30 days.",
preservationInterval: "source retention horizon",
sourceRetentionDays: 30,
targetRetentionDays: 30,
},
],
},
// local-schema:bump appends the next step above this line.
]
3 changes: 3 additions & 0 deletions apps/cli/src/server/schema-identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import schemaV20Sql from "./schema/local-schema-v20.sql" with { type: "text" }
import schemaV21Sql from "./schema/local-schema-v21.sql" with { type: "text" }
import schemaV22Sql from "./schema/local-schema-v22.sql" with { type: "text" }
import schemaV23Sql from "./schema/local-schema-v23.sql" with { type: "text" }
import schemaV24Sql from "./schema/local-schema-v24.sql" with { type: "text" }
import { schemaDigest as digestSchema, schemaFingerprint as fingerprintSchema } from "./store-version"
import { buildLocalSchemaManifest, type LocalSchemaManifest } from "./schema-manifest"
import { LOCAL_SCHEMA_VERSION } from "./local-schema-version"
Expand Down Expand Up @@ -89,6 +90,7 @@ const SNAPSHOT_SQL: ReadonlyArray<string> = [
schemaV21Sql,
schemaV22Sql,
schemaV23Sql,
schemaV24Sql,
]

export interface LocalSchemaSnapshot {
Expand Down Expand Up @@ -169,6 +171,7 @@ export const LOCAL_SCHEMA_V20 = localSchemaIdentity(20)
export const LOCAL_SCHEMA_V21 = localSchemaIdentity(21)
export const LOCAL_SCHEMA_V22 = localSchemaIdentity(22)
export const LOCAL_SCHEMA_V23 = localSchemaIdentity(23)
export const LOCAL_SCHEMA_V24 = localSchemaIdentity(24)

export const CURRENT_LOCAL_SCHEMA: LocalSchemaIdentity = Object.freeze({
version: LOCAL_SCHEMA_VERSION,
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/server/schema/local-inserts.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"projectRevision": "455ff9a387c6e0b10a3083278c020d73ea622f1e30a106fb833bcb2262a94d6f",
"projectRevision": "fdd5816bd9f83325d3bcc1eac0c3d5a872035552bbb1ed9600d7c8464692fe89",
"orgPlaceholder": "__ORG__",
"datasources": {
"traces": {
Expand Down
Loading
Loading