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
63 changes: 63 additions & 0 deletions apps/cli/src/server/local-store-migrations/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ const SERVICE_OPERATIONS_HTTP_COLUMNS = [
["RequestBodyCount", "SimpleAggregateFunction(sum, UInt64)"],
] as const

/** The SLO latency coverage total and eight ladder counters v51 adds to both service-overview rollups. */
const SERVICE_OVERVIEW_SLO_LATENCY_COLUMNS = [
["EstimatedLadderSpanCount", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
["EstimatedUnder50Ms", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
["EstimatedUnder100Ms", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
["EstimatedUnder250Ms", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
["EstimatedUnder500Ms", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
["EstimatedUnder1000Ms", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
["EstimatedUnder2500Ms", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
["EstimatedUnder5000Ms", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
["EstimatedUnder10000Ms", "SimpleAggregateFunction(sum, Float64) DEFAULT 0"],
] as const

export const LOCAL_STORE_STEPS: ReadonlyArray<StepSpec> = [
{
id: "local-0001-to-0002-error-rollup",
Expand Down Expand Up @@ -1914,5 +1927,55 @@ export const LOCAL_STORE_STEPS: ReadonlyArray<StepSpec> = [
},
],
},
{
// TODO(v50 -> v51): what changes, and what is NOT backfilled. Fill beforeBootstrap
// with the ADD COLUMN / view drops an IF NOT EXISTS bootstrap cannot do, then the
// plan line and dispositions. The v51 physical verify fails an unfinished row.
// Metadata-only counters on both service-overview rollups; the views are recreated to fill
// them. Existing buckets read 0 and are not backfilled: the hourly tier outlives raw traces.
id: "local-0050-to-0051-service-overview-slo-latency-ladder",
from: 50,
to: 51,
description:
"Add the SLO latency ladder counters to service_overview_hourly and service_overview_minutely and recreate their views",
clonedBefore: "any DDL runs",
beforeBootstrap: [
addColumns("service_overview_hourly", SERVICE_OVERVIEW_SLO_LATENCY_COLUMNS),
addColumns("service_overview_minutely", SERVICE_OVERVIEW_SLO_LATENCY_COLUMNS),
dropViews("service_overview_hourly_mv", "service_overview_minutely_mv"),
],
counts: {
group: "rollupRows",
measure: [
["hourly", "SELECT toString(count()) AS count FROM service_overview_hourly"],
["minutely", "SELECT toString(count()) AS count FROM service_overview_minutely"],
],
checks: [unchangedRowCount("hourly"), unchangedRowCount("minutely")],
},
plan: [
[
"add-service-overview-slo-latency-ladder",
"Add the SLO latency coverage total and eight ladder counters to both service-overview rollups and recreate their views so new buckets count spans under each threshold",
],
],
verifies: "Verify the v51 physical schema, retained raw telemetry counts, and the rollup row counts",
dispositions: [
TRACES_UNDER_REPLACED_VIEWS,
{
name: "service_overview_hourly",
classification: "derived",
disposition: "preserve-exact",
guarantee:
"Nine counter columns are added as metadata-only defaults; no part is rewritten, the row count is verified unchanged, and existing rows read the ladder and its EstimatedLadderSpanCount coverage as zero.",
},
{
name: "service_overview_minutely",
classification: "derived",
disposition: "preserve-exact",
guarantee:
"Nine counter columns are added as metadata-only defaults; no part is rewritten, the row count is verified unchanged, and existing rows read the ladder and its EstimatedLadderSpanCount coverage as zero.",
},
],
},
// local-schema:bump appends the next step above this line.
]
2 changes: 2 additions & 0 deletions apps/cli/src/server/schema-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import schemaV47Sql from "./schema/local-schema-v47.sql" with { type: "text" }
import schemaV48Sql from "./schema/local-schema-v48.sql" with { type: "text" }
import schemaV49Sql from "./schema/local-schema-v49.sql" with { type: "text" }
import schemaV50Sql from "./schema/local-schema-v50.sql" with { type: "text" }
import schemaV51Sql from "./schema/local-schema-v51.sql" with { type: "text" }
import { buildLocalSchemaManifest, type LocalSchemaManifest } from "@maple/local-server/schema-manifest"
import { Array as Arr } from "effect"

Expand Down Expand Up @@ -111,6 +112,7 @@ const SNAPSHOT_SQL: ReadonlyArray<string> = [
schemaV48Sql,
schemaV49Sql,
schemaV50Sql,
schemaV51Sql,
]

export interface LocalSchemaSnapshot {
Expand Down
Loading
Loading