diff --git a/.gitignore b/.gitignore index 8d10b8ce..b7ed4bfe 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,5 @@ skills-lock.json .mcp.json tmp + +.tinyb \ No newline at end of file diff --git a/apps/checker/handlers/dns.go b/apps/checker/handlers/dns.go index 6c5c776a..face331a 100644 --- a/apps/checker/handlers/dns.go +++ b/apps/checker/handlers/dns.go @@ -246,7 +246,7 @@ func (h Handler) DNSHandler(c *gin.Context) { func (h Handler) DNSHandlerRegion(c *gin.Context) { ctx := c.Request.Context() - dataSourceName := "check_dns_response__v0" + dataSourceName := "check_response_dns__v0" const defaultRetry = 3 // Authorization check diff --git a/apps/checker/handlers/tcp.go b/apps/checker/handlers/tcp.go index 1a46f860..678277cb 100644 --- a/apps/checker/handlers/tcp.go +++ b/apps/checker/handlers/tcp.go @@ -256,7 +256,7 @@ func (h Handler) TCPHandler(c *gin.Context) { func (h Handler) TCPHandlerRegion(c *gin.Context) { ctx := c.Request.Context() - dataSourceName := "check_tcp_response__v1" + dataSourceName := "check_response_tcp__v0" region := c.Param("region") if region == "" { diff --git a/packages/tinybird/README.md b/packages/tinybird/README.md index d0a7b632..485391d6 100644 --- a/packages/tinybird/README.md +++ b/packages/tinybird/README.md @@ -1,52 +1,130 @@ -### A guide on how to migrate your tinybird datasource +# @openstatus/tinybird -> What to do when you want to add/remove/update a column in your `datasource`. +Tinybird holds the monitoring time-series: every check result the probing tier +produces lands here. Turso (see `packages/db`) holds application data. The two +are linked by id only — no join across the boundary. -The `_migration` folder includes: +This package is two things: -- `ping_response__v4.datasource` which represents the `VERSION 4` of our - datasource -- `ping_response.datasource` which has the upgraded schema and a new `VERSION 5` -- `tb_backfill_populate.pipe` will fill the datasource with all the data until a - given timestamp -- `tb_materialized_until_change_ingest.pipe` will fill the data from a given - timestamp +- **Datafiles** (`datasources/`, `materializations/`, `endpoints/`) — the schema + and queries, deployed with the `tb` CLI. +- **A typed client** (`src/client.ts`) — zod-validated wrappers over the + published endpoints, consumed by the apps. +## Now on Tinybird Forward + +This project has migrated from Tinybird Classic to **Tinybird Forward**. If you +last touched it under Classic, these are the changes that matter: + +| Classic | Forward | +| --- | --- | +| `pip install tinybird-cli` | `pip install tinybird` (or `uv tool install tinybird`) — currently 4.6.14 | +| `tb push` / `tb pull` | `tb deploy` — no push command exists anymore | +| Resources updated in place | Deployments: build a staging one, then promote | +| New `VERSION` + backfill pipes per schema change | Change the schema in place; add `FORWARD_QUERY` when existing rows need transforming | +| Datafiles anywhere | `datasources/`, `materializations/`, `endpoints/` | + +The old `_migration/` folder and its `VERSION`-bumping recipe are gone. Nothing +in this repo uses `tb push`. + +> `tb migrate-to-forward` exists in the CLI for workspaces still on Classic. +> This one is already migrated — you do not need it. + +## Deploying to Tinybird Cloud + +From this directory, after `tb login`: + +```bash +tb --cloud deploy --check # validate; changes nothing +tb --cloud deployment create --wait # build staging, run any backfills +tb --cloud deployment promote # go live ``` -tb push _migration/ping_response.datasource -tb push _migration/tb_materialized_until_change_ingest.pipe -# after the given ts, it is time to run the backfill populate -tb push _migration/tb_backfill_populate.pipe --populate --wait -# after populate ends, it is time to remove the pipe -tb pipe rm tb_backfill_populate --yes -``` -Check if all the rows have been migrated: +`tb --cloud deploy` collapses the last two into one step. Prefer the split form +when the diff touches a materialized view: `create` is where data gets copied, +and you get to see it land before promoting. `tb --cloud deployment discard` +throws a staging deployment away. + +## Changing a schema + +Materialized views are the sharp edge. A `.pipe` under `materializations/` and +its target `.datasource` must agree on **both** column names and order, so a +column added to a source datasource has to be added in three places: + +1. the source `.datasource`, +2. the target `mv__*.datasource` schema, +3. the `SELECT` in the `aggregate__*.pipe` that feeds it. + +Never write `SELECT *` in a materialization. It silently breaks the next time a +column is added to the source — the pipe starts producing a column the target +has no slot for, and the deploy fails. + +When the target datasource already exists in the cloud, `deployment create` +repopulates it by re-running the materialized pipe over the source, so +historical rows get real values rather than nulls. Check the "Data that will be +copied with this deployment" table in `--check` output to confirm. That +repopulation is not free — it re-materializes the full retention window. + +Adding a nullable column, or a non-nullable one whose ClickHouse default is +acceptable for old rows, needs nothing extra. Use `FORWARD_QUERY` when existing +rows need a real transformation — a genuine default, a type change, a rename: ``` -tb pipe _migration/tb_datasource_union.pipe -# after checking the result of the pipe -tb pipe rm tb_datasource_union.pipe --yes +FORWARD_QUERY > + SELECT *, 'unknown' AS source ``` ---- +It is a `SELECT` list only, no `FROM`/`WHERE`, and it applies to existing data +until the next deploy compacts it. Remove it once the change is live. + +## Self-hosting -Link to the [issue](https://github.com/openstatusHQ/openstatus/issues/278) from -Gonzalo as reference. +**Tinybird is optional.** Openstatus runs without it; you lose the charts and +the time-series views. Set `TINYBIRD_NOOP=true` and every pipe and ingest call +resolves to empty instead of hitting the network. +To run it for real, you have two options. - +### Tinybird Local + +`docker compose up` starts a `tinybird-local` container (port `7181`) alongside +the rest of the stack. It comes up empty — the datafiles still need deploying: ```bash -python3 -m venv .venv -source .venv/bin/activate -pip install tinybird-cli -tb auth -i +cd packages/tinybird +tb --local deploy ``` +Then point the apps at it: + ```bash -tb pull -tb push aggregate_*.pipe --populate -tb push endpoint_*.pipe -... -``` \ No newline at end of file +TINYBIRD_URL=http://localhost:7181 +TINY_BIRD_API_KEY= # tb --local token ls, then tb --local token copy +``` + +### Tinybird Cloud + +Create a workspace, deploy the datafiles with the commands above, and set +`TINY_BIRD_API_KEY` to a token with read access to the endpoints. +`TINYBIRD_URL` can stay empty — it defaults to `https://api.tinybird.co`. + +## Gotcha: do not add a `tinybird.config.json` here + +There was one; it has been removed on purpose. The CLI classifies a project by +scanning the paths named in that config's `folder`/`include` for source-file +extensions. With `"folder": "."` the scan covers this whole package, finds the +`.ts` files in `src/` and `scripts/`, decides it is a TypeScript-SDK project, +and then fails on every command — including `tb --help`: + +``` +Error: Failed to generate Tinybird resources from TypeScript definitions. +Unable to load Tinybird SDK generator bridge. Cannot find package '@tinybirdco/sdk' +``` + +`include` only adds scan targets, so there is no way to narrow it. Without the +config, the CLI falls back to detecting `datasources/` and friends and treats +this as a plain datafiles project, which is what we want. + +If you ever do need a config here — for `dev_mode`, say — move the datafile +folders into a subdirectory with no `.ts` beside them and point `folder` at +that. diff --git a/packages/tinybird/datasources/audit_log__v0.datasource b/packages/tinybird/datasources/audit_log__v0.datasource index 4fa11660..28d7e60b 100644 --- a/packages/tinybird/datasources/audit_log__v0.datasource +++ b/packages/tinybird/datasources/audit_log__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 SCHEMA > `action` String `json:$.action`, diff --git a/packages/tinybird/datasources/check_response.datasource b/packages/tinybird/datasources/check_response.datasource deleted file mode 100644 index 1673dffe..00000000 --- a/packages/tinybird/datasources/check_response.datasource +++ /dev/null @@ -1,24 +0,0 @@ -VERSION 0 - -SCHEMA > - `requestId` Int64 `json:$.requestId`, - `workspaceId` Int64 `json:$.workspaceId`, - `latency` Int64 `json:$.latency`, - `region` String `json:$.region`, - `time` DateTime `json:$.time`, - `headers` String `json:$.headers`, - `timing_connectDone` Int64 `json:$.timing.connectDone`, - `timing_connectStart` Int64 `json:$.timing.connectStart`, - `timing_dnsDone` Int64 `json:$.timing.dnsDone`, - `timing_dnsStart` Int64 `json:$.timing.dnsStart`, - `timing_firstByteDone` Int64 `json:$.timing.firstByteDone`, - `timing_firstByteStart` Int64 `json:$.timing.firstByteStart`, - `timing_tlsHandshakeDone` Int64 `json:$.timing.tlsHandshakeDone`, - `timing_tlsHandshakeStart` Int64 `json:$.timing.tlsHandshakeStart`, - `timing_transferDone` Int64 `json:$.timing.transferDone`, - `timing_transferStart` Int64 `json:$.timing.transferStart` - -ENGINE "MergeTree" -ENGINE_SORTING_KEY "workspaceId, requestId, time" -ENGINE_TTL "" -ENGINE_PARTITION_KEY "" \ No newline at end of file diff --git a/packages/tinybird/datasources/check_response_dns__v0.datasource b/packages/tinybird/datasources/check_response_dns__v0.datasource new file mode 100644 index 00000000..da7f9ee8 --- /dev/null +++ b/packages/tinybird/datasources/check_response_dns__v0.datasource @@ -0,0 +1,19 @@ + +SCHEMA > + `assertions` String `json:$.assertions`, + `cronTimestamp` Int64 `json:$.cronTimestamp`, + `error` Int16 `json:$.error`, + `errorMessage` String `json:$.errorMessage`, + `id` String `json:$.id`, + `latency` Int16 `json:$.latency`, + `monitorId` Int16 `json:$.monitorId`, + `records` String `json:$.records`, + `region` String `json:$.region`, + `requestStatus` String `json:$.requestStatus`, + `timestamp` Int64 `json:$.timestamp`, + `trigger` String `json:$.trigger`, + `uri` String `json:$.uri`, + `workspaceId` Int16 `json:$.workspaceId` + +ENGINE "MergeTree" +ENGINE_SORTING_KEY "trigger, uri, workspaceId" diff --git a/packages/tinybird/datasources/check_response_http.datasource b/packages/tinybird/datasources/check_response_http__v0.datasource similarity index 97% rename from packages/tinybird/datasources/check_response_http.datasource rename to packages/tinybird/datasources/check_response_http__v0.datasource index 0e286d05..ef81a357 100644 --- a/packages/tinybird/datasources/check_response_http.datasource +++ b/packages/tinybird/datasources/check_response_http__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 SCHEMA > `body` String `json:$.body`, diff --git a/packages/tinybird/datasources/dns_response__v0.datasource b/packages/tinybird/datasources/dns_response__v0.datasource index e6b124d0..da7f9ee8 100644 --- a/packages/tinybird/datasources/dns_response__v0.datasource +++ b/packages/tinybird/datasources/dns_response__v0.datasource @@ -1,7 +1,6 @@ SCHEMA > - `assertions` Nullable(String) `json:$.assertions`, - `timing` String `json:$.timing`, + `assertions` String `json:$.assertions`, `cronTimestamp` Int64 `json:$.cronTimestamp`, `error` Int16 `json:$.error`, `errorMessage` String `json:$.errorMessage`, diff --git a/packages/tinybird/datasources/external_status__v1.datasource b/packages/tinybird/datasources/external_status__v1.datasource index 3dfdeb51..e72ca5b6 100644 --- a/packages/tinybird/datasources/external_status__v1.datasource +++ b/packages/tinybird/datasources/external_status__v1.datasource @@ -1,3 +1,4 @@ + SCHEMA > `id` String `json:$.id`, `indicator` String `json:$.indicator`, @@ -9,4 +10,4 @@ SCHEMA > ENGINE "MergeTree" ENGINE_SORTING_KEY "id, fetched_at" -ENGINE_TTL "toDateTime(fromUnixTimestamp64Milli(fetched_at)) + INTERVAL 60 DAY" +ENGINE_TTL "toDateTime(fromUnixTimestamp64Milli(fetched_at)) + toIntervalDay(60)" diff --git a/packages/tinybird/datasources/external_status_component__v0.datasource b/packages/tinybird/datasources/external_status_component__v0.datasource index 5b8f1ffa..2d6302f8 100644 --- a/packages/tinybird/datasources/external_status_component__v0.datasource +++ b/packages/tinybird/datasources/external_status_component__v0.datasource @@ -1,6 +1,3 @@ -# `external_service_id` is denormalised for raw-row traceability only: in raw -# rows `component_id` is an opaque PK, so this lets ops trace a snapshot back to -# its service without a Turso join. Pipes/MV key on `component_id`. SCHEMA > `component_id` String `json:$.component_id`, @@ -11,4 +8,4 @@ SCHEMA > ENGINE "MergeTree" ENGINE_SORTING_KEY "component_id, fetched_at" -ENGINE_TTL "toDateTime(fromUnixTimestamp64Milli(fetched_at)) + INTERVAL 60 DAY" +ENGINE_TTL "toDateTime(fromUnixTimestamp64Milli(fetched_at)) + toIntervalDay(60)" diff --git a/packages/tinybird/datasources/mv__external_status_component_daily__v0.datasource b/packages/tinybird/datasources/mv__external_status_component_daily__v0.datasource index bb1e4160..d803f30c 100644 --- a/packages/tinybird/datasources/mv__external_status_component_daily__v0.datasource +++ b/packages/tinybird/datasources/mv__external_status_component_daily__v0.datasource @@ -1,4 +1,4 @@ -# Data Source created from Pipe 'mv__external_status_component_daily__v0' +# Data Source created from Pipe 'aggregate__external_status_component__daily__v0' SCHEMA > `day` Date, diff --git a/packages/tinybird/datasources/mv__external_status_daily__v0.datasource b/packages/tinybird/datasources/mv__external_status_daily__v0.datasource index 81d7a415..558bfaf7 100644 --- a/packages/tinybird/datasources/mv__external_status_daily__v0.datasource +++ b/packages/tinybird/datasources/mv__external_status_daily__v0.datasource @@ -1,4 +1,3 @@ -# Data Source created from Pipe 'mv__external_status_daily__v0' SCHEMA > `day` Date, diff --git a/packages/tinybird/datasources/mv__http_14d.datasource b/packages/tinybird/datasources/mv__http_14d.datasource deleted file mode 100644 index 5195321a..00000000 --- a/packages/tinybird/datasources/mv__http_14d.datasource +++ /dev/null @@ -1,19 +0,0 @@ -VERSION 0 -# Data Source created from Pipe 'aggregate__http_14d__v0' - -SCHEMA > - `time` DateTime, - `latency` Int64, - `error` Int8, - `region` LowCardinality(String), - `trigger` Nullable(String), - `statusCode` Nullable(Int16), - `timestamp` Int64, - `cronTimestamp` Int64, - `monitorId` String, - `workspaceId` String - -ENGINE "MergeTree" -ENGINE_PARTITION_KEY "toYYYYMM(time)" -ENGINE_SORTING_KEY "monitorId, time" -ENGINE_TTL "time + toIntervalDay(14)" diff --git a/packages/tinybird/datasources/mv__http_14d__v0.datasource b/packages/tinybird/datasources/mv__http_14d__v0.datasource index 5195321a..917f6230 100644 --- a/packages/tinybird/datasources/mv__http_14d__v0.datasource +++ b/packages/tinybird/datasources/mv__http_14d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__http_14d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__http_1d__v0.datasource b/packages/tinybird/datasources/mv__http_1d__v0.datasource index 764c43d4..bdce0cd9 100644 --- a/packages/tinybird/datasources/mv__http_1d__v0.datasource +++ b/packages/tinybird/datasources/mv__http_1d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__http_1d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__http_1d__v1.datasource b/packages/tinybird/datasources/mv__http_1d__v1.datasource index 243c2e28..9ea2fa46 100644 --- a/packages/tinybird/datasources/mv__http_1d__v1.datasource +++ b/packages/tinybird/datasources/mv__http_1d__v1.datasource @@ -4,13 +4,13 @@ SCHEMA > `time` DateTime, `id` Nullable(String), `latency` Int64, - `requestStatus` Nullable(String), `region` LowCardinality(String), `trigger` Nullable(String), `statusCode` Nullable(Int16), `timestamp` Int64, `cronTimestamp` Int64, `monitorId` String, + `requestStatus` Nullable(String), `timing` Nullable(String) ENGINE "MergeTree" diff --git a/packages/tinybird/datasources/mv__http_30d__v0.datasource b/packages/tinybird/datasources/mv__http_30d__v0.datasource index 6c116f20..820c4a85 100644 --- a/packages/tinybird/datasources/mv__http_30d__v0.datasource +++ b/packages/tinybird/datasources/mv__http_30d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__http_30d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__http_7d__v0.datasource b/packages/tinybird/datasources/mv__http_7d__v0.datasource index a45060c0..c2d6588c 100644 --- a/packages/tinybird/datasources/mv__http_7d__v0.datasource +++ b/packages/tinybird/datasources/mv__http_7d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__http_7d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__http_full_14d__v0.datasource b/packages/tinybird/datasources/mv__http_full_14d__v0.datasource index 95a905e1..a095321f 100644 --- a/packages/tinybird/datasources/mv__http_full_14d__v0.datasource +++ b/packages/tinybird/datasources/mv__http_full_14d__v0.datasource @@ -19,8 +19,7 @@ SCHEMA > `trigger` Nullable(String), `id` Nullable(String), `requestStatus` Nullable(String), - `method` Nullable(String) - + `method` String ENGINE "MergeTree" ENGINE_PARTITION_KEY "toYYYYMM(time)" diff --git a/packages/tinybird/datasources/mv__http_full_30d__v0.datasource b/packages/tinybird/datasources/mv__http_full_30d__v0.datasource index fbf14975..76b172c7 100644 --- a/packages/tinybird/datasources/mv__http_full_30d__v0.datasource +++ b/packages/tinybird/datasources/mv__http_full_30d__v0.datasource @@ -19,8 +19,7 @@ SCHEMA > `trigger` Nullable(String), `id` Nullable(String), `requestStatus` Nullable(String), - `method` Nullable(String) - + `method` String ENGINE "MergeTree" ENGINE_PARTITION_KEY "toYYYYMM(time)" diff --git a/packages/tinybird/datasources/mv__http_status_45d__v0.datasource b/packages/tinybird/datasources/mv__http_status_45d__v0.datasource index ca1b3799..67fdd684 100644 --- a/packages/tinybird/datasources/mv__http_status_45d__v0.datasource +++ b/packages/tinybird/datasources/mv__http_status_45d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__http_status_45d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__http_status_7d__v0.datasource b/packages/tinybird/datasources/mv__http_status_7d__v0.datasource index 1c2e74fe..cbbc48fe 100644 --- a/packages/tinybird/datasources/mv__http_status_7d__v0.datasource +++ b/packages/tinybird/datasources/mv__http_status_7d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__http_status_7d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__http_timing_phases_14d.datasource b/packages/tinybird/datasources/mv__http_timing_phases_14d.datasource deleted file mode 100644 index b767183d..00000000 --- a/packages/tinybird/datasources/mv__http_timing_phases_14d.datasource +++ /dev/null @@ -1,21 +0,0 @@ -# Data Source created from Pipe 'aggregate__http_timing_phases_14d__v1' - -SCHEMA > - `time` DateTime, - `latency` Int64, - `region` LowCardinality(String), - `trigger` Nullable(String), - `statusCode` Nullable(Int16), - `monitorId` String, - `workspaceId` String, - `requestStatus` Nullable(String), - `dns` Nullable(Int64), - `connect` Nullable(Int64), - `tls` Nullable(Int64), - `firstByte` Nullable(Int64), - `transfer` Nullable(Int64) - -ENGINE "MergeTree" -ENGINE_PARTITION_KEY "toYYYYMM(time)" -ENGINE_SORTING_KEY "monitorId, time" -ENGINE_TTL "time + toIntervalDay(14)" diff --git a/packages/tinybird/datasources/mv__tcp_14d__v0.datasource b/packages/tinybird/datasources/mv__tcp_14d__v0.datasource index 79098c67..bf67d58a 100644 --- a/packages/tinybird/datasources/mv__tcp_14d__v0.datasource +++ b/packages/tinybird/datasources/mv__tcp_14d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__tcp_14d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__tcp_1d__v0.datasource b/packages/tinybird/datasources/mv__tcp_1d__v0.datasource index 4621e547..69c7b517 100644 --- a/packages/tinybird/datasources/mv__tcp_1d__v0.datasource +++ b/packages/tinybird/datasources/mv__tcp_1d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__tcp_1d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__tcp_30d__v0.datasource b/packages/tinybird/datasources/mv__tcp_30d__v0.datasource index 5a618550..63cb5ddf 100644 --- a/packages/tinybird/datasources/mv__tcp_30d__v0.datasource +++ b/packages/tinybird/datasources/mv__tcp_30d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__tcp_30d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__tcp_7d__v0.datasource b/packages/tinybird/datasources/mv__tcp_7d__v0.datasource index 278da974..4860c3ea 100644 --- a/packages/tinybird/datasources/mv__tcp_7d__v0.datasource +++ b/packages/tinybird/datasources/mv__tcp_7d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__tcp_7d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__tcp_status_45d__v0.datasource b/packages/tinybird/datasources/mv__tcp_status_45d__v0.datasource index 3bb59b74..8cd11b1b 100644 --- a/packages/tinybird/datasources/mv__tcp_status_45d__v0.datasource +++ b/packages/tinybird/datasources/mv__tcp_status_45d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__tcp_status_45d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv__tcp_status_7d__v0.datasource b/packages/tinybird/datasources/mv__tcp_status_7d__v0.datasource index e3eea9c9..327ba349 100644 --- a/packages/tinybird/datasources/mv__tcp_status_7d__v0.datasource +++ b/packages/tinybird/datasources/mv__tcp_status_7d__v0.datasource @@ -1,4 +1,3 @@ -VERSION 0 # Data Source created from Pipe 'aggregate__tcp_status_7d__v0' SCHEMA > diff --git a/packages/tinybird/datasources/mv_http_status_14d.datasource b/packages/tinybird/datasources/mv_http_status_14d.datasource deleted file mode 100644 index ab57875b..00000000 --- a/packages/tinybird/datasources/mv_http_status_14d.datasource +++ /dev/null @@ -1,15 +0,0 @@ -# Data Source created from Pipe 'aggregate__http_status_14d__v0' -VERSION 0 - -SCHEMA > - `time` DateTime('UTC'), - `monitorId` String, - `total` AggregateFunction(count), - `success` AggregateFunction(count, Nullable(UInt8)), - `degraded` AggregateFunction(count, Nullable(UInt8)), - `error` AggregateFunction(count, Nullable(UInt8)) - -ENGINE "AggregatingMergeTree" -ENGINE_PARTITION_KEY "toYYYYMM(time)" -ENGINE_SORTING_KEY "monitorId, time" -ENGINE_TTL "time + toIntervalDay(14)" diff --git a/packages/tinybird/datasources/tcp_response.datasource b/packages/tinybird/datasources/tcp_response.datasource deleted file mode 100644 index 35c6304d..00000000 --- a/packages/tinybird/datasources/tcp_response.datasource +++ /dev/null @@ -1,19 +0,0 @@ -VERSION 0 - -SCHEMA > - `monitorId` Int32 `json:$.monitorId`, - `region` String `json:$.region`, - `timestamp` Int64 `json:$.timestamp`, - `cronTimestamp` Int64 `json:$.timestamp`, - `timing` String `json:$.timing`, - `workspaceId` Int32 `json:$.workspaceId`, - `latency` Int64 `json:$.latency`, - `errorMessage` Nullable(String) `json:$.errorMessage`, - `error` Int16 `json:$.error`, - `trigger` Nullable(String) `json:$.trigger`, - `uri` Nullable(String) `json:$.uri` - - -ENGINE "MergeTree" -ENGINE_PARTITION_KEY "toYYYYMM(fromUnixTimestamp64Milli(timestamp))" -ENGINE_SORTING_KEY "monitorId, workspaceId" diff --git a/packages/tinybird/endpoints/endpoint__audit_log.pipe b/packages/tinybird/endpoints/endpoint__audit_log.pipe deleted file mode 100644 index 484e795b..00000000 --- a/packages/tinybird/endpoints/endpoint__audit_log.pipe +++ /dev/null @@ -1,17 +0,0 @@ -VERSION 1 - -TAGS endpoint - - -NODE endpoint -SQL > - - % - SELECT action, id, metadata, timestamp - FROM audit_log__v0 - WHERE - id = {{String(monitorId, 'monitor:1', required=True)}} - AND timestamp > toUnixTimestamp(now() - INTERVAL {{ Int64(interval, 30) }} day) * 1000 - ORDER BY timestamp DESC - -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__audit_log__v1.pipe b/packages/tinybird/endpoints/endpoint__audit_log__v1.pipe index 5ad399ac..f56e664a 100644 --- a/packages/tinybird/endpoints/endpoint__audit_log__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__audit_log__v1.pipe @@ -1,18 +1,16 @@ -VERSION 1 - -TAGS endpoint - +TOKEN "endpoint__audit_log__v1_endpoint_read_0873" READ NODE endpoint SQL > - % - SELECT action, id, metadata, timestamp - FROM audit_log__v0 - WHERE - id = {{String(monitorId, 'monitor:1', required=True)}} - AND timestamp > toUnixTimestamp(now() - INTERVAL {{ Int64(interval, 30) }} day) * 1000 - ORDER BY timestamp DESC +% +SELECT action, id, metadata, timestamp +FROM audit_log__v0 +WHERE + id = {{String(monitorId, 'monitor:1', required=True)}} + AND timestamp > toUnixTimestamp(now() - INTERVAL {{ Int64(interval, 30) }} day) * 1000 +ORDER BY timestamp DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_get_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_get_14d__v0.pipe index 1edb0b5d..82d2a2a2 100644 --- a/packages/tinybird/endpoints/endpoint__dns_get_14d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_get_14d__v0.pipe @@ -1,15 +1,16 @@ -TAGS "dns" +TOKEN "endpoint__dns_get_14d__v0_endpoint_read_7283" READ NODE endpoint SQL > - % - SELECT * - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND id = {{ String(id, '', required=True) }} - ORDER BY timestamp DESC +% + SELECT * + FROM dns_response__v0 + WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND id = {{ String(id, '', required=True) }} + ORDER BY timestamp DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_list_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_list_14d__v0.pipe index fce5897d..25a99dc1 100644 --- a/packages/tinybird/endpoints/endpoint__dns_list_14d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_list_14d__v0.pipe @@ -1,16 +1,17 @@ -TAGS "dns" +TOKEN "endpoint__dns_list_14d__v0_endpoint_read_1189" READ NODE endpoint SQL > - % - SELECT * - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - {% if defined(fromDate) %} AND timestamp >= toInt64({{ String(fromDate) }}) {% end %} - {% if defined(toDate) %} AND timestamp <= toInt64({{ String(toDate) }}) {% end %} - ORDER BY timestamp DESC +% +SELECT * +FROM dns_response__v0 +WHERE +monitorId = {{ String(monitorId, '7417', required=True) }} + {% if defined(fromDate) %} AND timestamp >= toInt64({{ String(fromDate) }}) {% end %} + {% if defined(toDate) %} AND timestamp <= toInt64({{ String(toDate) }}) {% end %} +ORDER BY timestamp DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_14d__v0.pipe index 18385a35..2cf480c4 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_14d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_14d__v0.pipe @@ -1,43 +1,44 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_14d__v1_endpoint_read_5551" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 14 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 28 DAY, 3)) - AND timestamp < toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 14 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM dns_response__v0 + WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 14 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM dns_response__v0 + WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 28 DAY, 3)) + AND timestamp < toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 14 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_1d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_1d__v0.pipe index 7db3011d..69a1d46b 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_1d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_1d__v0.pipe @@ -1,43 +1,44 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_1d__v1_endpoint_read_8759" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 1 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 2 DAY, 3)) - AND timestamp < toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 1 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM dns_response__v0 + WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 1 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM dns_response__v0 + WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 2 DAY, 3)) + AND timestamp < toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 1 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_30d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_30d__v0.pipe index 368a32af..08ea1066 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_30d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_30d__v0.pipe @@ -1,42 +1,44 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_30d__v0_endpoint_read_7067" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 30 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 60 DAY, 3)) - AND timestamp < toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 30 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% +SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 30 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +UNION ALL +SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 60 DAY, 3)) + AND timestamp < toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 30 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_7d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_7d__v0.pipe index 731df660..a3e601e9 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_7d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_7d__v0.pipe @@ -1,43 +1,44 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_7d__v1_endpoint_read_4418" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 7 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 14 DAY, 3)) - AND timestamp < toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 7 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM dns_response__v0 + WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 7 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM dns_response__v0 + WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 14 DAY, 3)) + AND timestamp < toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 7 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_90d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_90d__v0.pipe index 00f34c91..4cab92a7 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_90d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_90d__v0.pipe @@ -1,38 +1,40 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_90d__v0_endpoint_read_3836" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 90 DAY, 3)) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - -- no 90d comparison: emit an empty row to keep the 2-row contract; count 0 - -- makes the client suppress the trend badge (NaN). matches http/tcp 90d. - SELECT - 0 AS p50Latency, - 0 AS p75Latency, - 0 AS p90Latency, - 0 AS p95Latency, - 0 AS p99Latency, - 0 AS count, - 0 AS success, - 0 AS degraded, - 0 AS error, - NULL AS lastTimestamp +% +SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 90 DAY, 3)) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +UNION ALL +-- no 90d comparison: emit an empty row to keep the 2-row contract; count 0 +-- makes the client suppress the trend badge (NaN). matches http/tcp 90d. +SELECT + 0 AS p50Latency, + 0 AS p75Latency, + 0 AS p90Latency, + 0 AS p95Latency, + 0 AS p99Latency, + 0 AS count, + 0 AS success, + 0 AS degraded, + 0 AS error, + NULL AS lastTimestamp + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_global_1d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_global_1d__v0.pipe index 70ede409..851e6eff 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_global_1d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_global_1d__v0.pipe @@ -1,11 +1,9 @@ -VERSION 0 +TOKEN "endpoint__dns_metrics_global_1d__v0_endpoint_read_0694" READ -TAGS "dns" - -NODE endpoint +NODE endopint SQL > - % +% SELECT round(min(latency), 0) as minLatency, round(max(latency), 0) as maxLatency, @@ -22,5 +20,6 @@ SQL > AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 1 DAY, 3)) GROUP BY monitorId +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_latency_1d_multi__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_latency_1d_multi__v0.pipe index 74968f62..d2f077d1 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_latency_1d_multi__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_latency_1d_multi__v0.pipe @@ -1,26 +1,27 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_latency_1d_multi__v0_endpoint_read_4781" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - monitorId, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM dns_response__v0 - WHERE - monitorId IN {{ Array(monitorIds, 'String', '7417') }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 1 DAY, 3)) - GROUP BY h, monitorId - ORDER BY h ASC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + monitorId, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM dns_response__v0 +WHERE + monitorId IN {{ Array(monitorIds, 'String', '7417') }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 1 DAY, 3)) +GROUP BY h, monitorId +ORDER BY h ASC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_latency_30d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_latency_30d__v0.pipe index 94718c84..c08d8d68 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_latency_30d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_latency_30d__v0.pipe @@ -1,24 +1,26 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_latency_30d__v0_endpoint_read_4167" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 30 DAY, 3)) - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 30 DAY, 3)) +GROUP BY h +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_latency_7d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_latency_7d__v0.pipe index d9e3e3db..88b995aa 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_latency_7d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_latency_7d__v0.pipe @@ -1,30 +1,31 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_latency_7d__v1_endpoint_read_2009" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - {% if defined(fromDate) %} - AND toDateTime(timestamp / 1000) >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) - {% end %} - {% if defined(toDate) %} - AND toDateTime(timestamp / 1000) <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) - {% end %} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + {% if defined(fromDate) %} + AND toDateTime(timestamp / 1000) >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) + {% end %} + {% if defined(toDate) %} + AND toDateTime(timestamp / 1000) <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) + {% end %} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_latency_90d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_latency_90d__v0.pipe index 7f481e99..fb6b7c1f 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_latency_90d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_latency_90d__v0.pipe @@ -1,24 +1,26 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_latency_90d__v0_endpoint_read_8223" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 90 DAY, 3)) - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 90 DAY, 3)) +GROUP BY h +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_regions_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_regions_14d__v0.pipe index b34f37df..d4c957cb 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_regions_14d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_regions_14d__v0.pipe @@ -1,26 +1,35 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_regions_14d__v0_endpoint_read_2343" READ NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + -- dns_response__v0 has no TTL; cap the window like the TTL-bound http/tcp uptime MVs + AND toDateTime(timestamp / 1000) >= now() - INTERVAL 14 DAY + {% if defined(fromDate) %} + AND toDateTime(timestamp / 1000) >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) + {% end %} + {% if defined(toDate) %} + AND toDateTime(timestamp / 1000) <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) + {% end %} + {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_regions_30d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_regions_30d__v0.pipe index 51e02a67..afd5d23c 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_regions_30d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_regions_30d__v0.pipe @@ -1,26 +1,28 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_regions_30d__v0_endpoint_read_9332" READ NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 30 DAY, 3)) - {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 30 DAY, 3)) + {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_metrics_regions_90d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_metrics_regions_90d__v0.pipe index 49bb57f8..bc621f83 100644 --- a/packages/tinybird/endpoints/endpoint__dns_metrics_regions_90d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_metrics_regions_90d__v0.pipe @@ -1,26 +1,28 @@ -TAGS "dns" +TOKEN "endpoint__dns_metrics_regions_90d__v0_endpoint_read_7062" READ NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 90 DAY, 3)) - {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + AND timestamp >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 90 DAY, 3)) + {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_status_45d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_status_45d__v0.pipe index 49376ca4..09ecabf3 100644 --- a/packages/tinybird/endpoints/endpoint__dns_status_45d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_status_45d__v0.pipe @@ -1,20 +1,21 @@ -TAGS "dns" +TOKEN "endpoint__dns_status_45d__v1_endpoint_read_7024" READ NODE endpoint SQL > - % - SELECT - time as day, - monitorId, - countMerge(count) as count, - countMerge(success) as ok, - countMerge(error) as error, - countMerge(degraded) as degraded - FROM mv__dns_status_45d__v0 - WHERE monitorId IN {{ Array(monitorIds, 'String', '7417') }} - GROUP BY day, monitorId - ORDER BY day DESC +% +SELECT + time as day, + monitorId, + countMerge(count) as count, + countMerge(success) as ok, + countMerge(error) as error, + countMerge(degraded) as degraded +FROM mv__dns_status_45d__v0 +WHERE monitorId IN {{ Array(monitorIds, 'String', '7417') }} +GROUP BY day, monitorId +ORDER BY day DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_uptime_30d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_uptime_30d__v0.pipe index 1a7b9fc6..352960a4 100644 --- a/packages/tinybird/endpoints/endpoint__dns_uptime_30d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_uptime_30d__v0.pipe @@ -1,30 +1,31 @@ -TAGS "dns" +TOKEN "endpoint__dns_uptime_30d__v1_endpoint_read_4617" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(timestamp / 1000), INTERVAL {{ String(interval, '30', required=True) }} minute - ) AS interval, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - -- dns_response__v0 has no TTL; cap the window like the TTL-bound http/tcp uptime MVs - AND toDateTime(timestamp / 1000) >= now() - INTERVAL 30 DAY - {% if defined(fromDate) %} - AND toDateTime(timestamp / 1000) >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) - {% end %} - {% if defined(toDate) %} - AND toDateTime(timestamp / 1000) <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) - {% end %} - {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY interval - ORDER BY interval DESC +% +SELECT + toStartOfInterval( + toDateTime(timestamp / 1000), INTERVAL {{ String(interval, '30', required=True) }} minute + ) AS interval, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + -- dns_response__v0 has no TTL; cap the window like the TTL-bound http/tcp uptime MVs + AND toDateTime(timestamp / 1000) >= now() - INTERVAL 30 DAY + {% if defined(fromDate) %} + AND toDateTime(timestamp / 1000) >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) + {% end %} + {% if defined(toDate) %} + AND toDateTime(timestamp / 1000) <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) + {% end %} + {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY interval +ORDER BY interval DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__dns_uptime_90d__v0.pipe b/packages/tinybird/endpoints/endpoint__dns_uptime_90d__v0.pipe index 8ea04645..e3260abc 100644 --- a/packages/tinybird/endpoints/endpoint__dns_uptime_90d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__dns_uptime_90d__v0.pipe @@ -1,29 +1,31 @@ -TAGS "dns" +TOKEN "endpoint__dns_uptime_90d__v0_endpoint_read_3446" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(timestamp / 1000), INTERVAL {{ String(interval, '1440', required=True) }} minute - ) AS interval, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error - FROM dns_response__v0 - WHERE - monitorId = {{ String(monitorId, '7417', required=True) }} - -- dns_response__v0 has no TTL; cap the window like the TTL-bound http/tcp uptime MVs - AND toDateTime(timestamp / 1000) >= now() - INTERVAL 90 DAY - {% if defined(fromDate) %} - AND toDateTime(timestamp / 1000) >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) - {% end %} - {% if defined(toDate) %} - AND toDateTime(timestamp / 1000) <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) - {% end %} - {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY interval - ORDER BY interval DESC +% +SELECT + toStartOfInterval( + toDateTime(timestamp / 1000), INTERVAL {{ String(interval, '1440', required=True) }} minute + ) AS interval, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error +FROM dns_response__v0 +WHERE + monitorId = {{ String(monitorId, '7417', required=True) }} + -- dns_response__v0 has no TTL; cap the window like the TTL-bound http/tcp uptime MVs + AND toDateTime(timestamp / 1000) >= now() - INTERVAL 90 DAY + {% if defined(fromDate) %} + AND toDateTime(timestamp / 1000) >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) + {% end %} + {% if defined(toDate) %} + AND toDateTime(timestamp / 1000) <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) + {% end %} + {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY interval +ORDER BY interval DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__external_status.pipe b/packages/tinybird/endpoints/endpoint__external_status.pipe deleted file mode 100644 index 39f276fc..00000000 --- a/packages/tinybird/endpoints/endpoint__external_status.pipe +++ /dev/null @@ -1,13 +0,0 @@ -VERSION 0 -NODE external_status_0 -SQL > - - % - SELECT * - FROM external_status - WHERE name = {{ String(name, 'OpenAI') }} - ORDER BY fetched_at DESC - LIMIT {{ Int16(limit, 10000) }} - - -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__external_status_component_history__v0.pipe b/packages/tinybird/endpoints/endpoint__external_status_component_history__v0.pipe index d7b09255..e7a61f52 100644 --- a/packages/tinybird/endpoints/endpoint__external_status_component_history__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__external_status_component_history__v0.pipe @@ -1,9 +1,9 @@ -TAGS "external_status" +TOKEN "endpoint__external_status_component_history__v0_endpoint_read_4435" READ -NODE history +NODE endpoint SQL > - % +% SELECT day, component_id, @@ -18,4 +18,6 @@ SQL > GROUP BY day, component_id ORDER BY day ASC -TYPE ENDPOINT +TYPE endpoint + + diff --git a/packages/tinybird/endpoints/endpoint__external_status_component_latest__v0.pipe b/packages/tinybird/endpoints/endpoint__external_status_component_latest__v0.pipe index 1b0f3afd..ecda61dd 100644 --- a/packages/tinybird/endpoints/endpoint__external_status_component_latest__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__external_status_component_latest__v0.pipe @@ -1,16 +1,18 @@ -TAGS "external_status_component" +TOKEN "endpoint__external_statuscomponent__latest__v0_endpoint_read_4246" READ -NODE latest +NODE endpoint SQL > - % - SELECT - component_id, - argMax(indicator, fetched_at) AS indicator, - argMax(status, fetched_at) AS status, - max(fetched_at) AS last_fetched_at - FROM external_status_component__v0 - WHERE component_id IN {{ Array(component_ids, 'String') }} - GROUP BY component_id +% +SELECT + component_id, + argMax(indicator, fetched_at) AS indicator, + argMax(status, fetched_at) AS status, + max(fetched_at) AS last_fetched_at +FROM external_status_component__v0 +WHERE component_id IN {{ Array(component_ids, 'String') }} +GROUP BY component_id + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__external_status_history__v0.pipe b/packages/tinybird/endpoints/endpoint__external_status_history__v0.pipe index adc9136f..9c6a8925 100644 --- a/packages/tinybird/endpoints/endpoint__external_status_history__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__external_status_history__v0.pipe @@ -1,9 +1,9 @@ -TAGS "external_status" +TOKEN "endpoint_external_status_history__v0_endpoint_read_3031" READ -NODE history +NODE endpoint SQL > - % +% SELECT day, id, @@ -18,4 +18,6 @@ SQL > GROUP BY day, id ORDER BY day ASC -TYPE ENDPOINT +TYPE endpoint + + diff --git a/packages/tinybird/endpoints/endpoint__external_status_latest__v1.pipe b/packages/tinybird/endpoints/endpoint__external_status_latest__v1.pipe index dd2f3e18..d5db855f 100644 --- a/packages/tinybird/endpoints/endpoint__external_status_latest__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__external_status_latest__v1.pipe @@ -1,9 +1,9 @@ -TAGS "external_status" +TOKEN "endpoint_external_status_latest__v1_endpoint_read_9973" READ -NODE latest +NODE endpoint SQL > - % +% SELECT id, argMax(indicator, fetched_at) AS indicator, @@ -18,4 +18,6 @@ SQL > {% end %} GROUP BY id -TYPE ENDPOINT +TYPE endpoint + + diff --git a/packages/tinybird/endpoints/endpoint__http_get_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_get_14d__v0.pipe index 51a91360..12a31020 100644 --- a/packages/tinybird/endpoints/endpoint__http_get_14d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__http_get_14d__v0.pipe @@ -1,15 +1,16 @@ -TAGS "http" +TOKEN "endpoint__http_get_14d__v0_endpoint_read_1831" READ NODE endpoint SQL > - % - SELECT * - FROM mv__http_full_14d__v0 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - AND id = {{ String(id, '', required=True) }} - ORDER BY time DESC +% +SELECT * +FROM mv__http_full_14d__v0 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + AND id = {{ String(id, '', required=True) }} +ORDER BY time DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_get_30d.pipe b/packages/tinybird/endpoints/endpoint__http_get_30d__v0.pipe similarity index 88% rename from packages/tinybird/endpoints/endpoint__http_get_30d.pipe rename to packages/tinybird/endpoints/endpoint__http_get_30d__v0.pipe index 2323a7e7..9ded3f7a 100644 --- a/packages/tinybird/endpoints/endpoint__http_get_30d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_get_30d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT * FROM mv__http_full_30d__v0 WHERE @@ -14,6 +10,6 @@ SQL > AND region = {{ String(region, 'ams', required=True) }} ORDER BY cronTimestamp DESC +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_list_14d.pipe b/packages/tinybird/endpoints/endpoint__http_list_14d__v0.pipe similarity index 80% rename from packages/tinybird/endpoints/endpoint__http_list_14d.pipe rename to packages/tinybird/endpoints/endpoint__http_list_14d__v0.pipe index 52040df3..73eb6593 100644 --- a/packages/tinybird/endpoints/endpoint__http_list_14d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_list_14d__v0.pipe @@ -1,15 +1,12 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT * FROM mv__http_14d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} ORDER BY cronTimestamp DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_list_14d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_list_14d__v1.pipe index fa5313f2..f8157dd6 100644 --- a/packages/tinybird/endpoints/endpoint__http_list_14d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_list_14d__v1.pipe @@ -1,23 +1,22 @@ -TAGS "http" +TOKEN "endpoint__http_list_14d__v1_endpoint_read_5685" READ NODE endpoint SQL > - % - SELECT * FROM mv__http_14d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if defined(fromDate) %} - AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) - {% end %} - {% if defined(toDate) %} - AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) - {% end %} - ORDER BY time DESC - {% if defined(limit) %} - LIMIT {{ Int32(limit) }} - OFFSET {{ Int32(offset, 0) }} - {% end %} +% +SELECT * +FROM mv__http_14d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if defined(fromDate) %} + AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) + {% end %} + {% if defined(toDate) %} + AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) + {% end %} +ORDER BY time DESC +{% if defined(limit) %} LIMIT {{ Int32(limit) }} OFFSET {{ Int32(offset, 0) }} {% end %} + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_list_1d.pipe b/packages/tinybird/endpoints/endpoint__http_list_1d__v0.pipe similarity index 80% rename from packages/tinybird/endpoints/endpoint__http_list_1d.pipe rename to packages/tinybird/endpoints/endpoint__http_list_1d__v0.pipe index 19564284..f8b5066b 100644 --- a/packages/tinybird/endpoints/endpoint__http_list_1d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_list_1d__v0.pipe @@ -1,15 +1,12 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT * FROM mv__http_1d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} ORDER BY cronTimestamp DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_list_1d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_list_1d__v1.pipe index 9537927d..8c613ac7 100644 --- a/packages/tinybird/endpoints/endpoint__http_list_1d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_list_1d__v1.pipe @@ -1,19 +1,17 @@ -TAGS "http" +TOKEN "endpoint__http_list_1d__v1_endpoint_read_1903" READ NODE endpoint SQL > - % - SELECT * FROM mv__http_1d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if defined(fromDate) %} - AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) - {% end %} - {% if defined(toDate) %} - AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) - {% end %} - ORDER BY time DESC +% +SELECT * +FROM mv__http_1d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if defined(fromDate) %} AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) {% end %} + {% if defined(toDate) %} AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) {% end %} +ORDER BY time DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_list_7d.pipe b/packages/tinybird/endpoints/endpoint__http_list_7d__v0.pipe similarity index 80% rename from packages/tinybird/endpoints/endpoint__http_list_7d.pipe rename to packages/tinybird/endpoints/endpoint__http_list_7d__v0.pipe index 827af343..905cddd0 100644 --- a/packages/tinybird/endpoints/endpoint__http_list_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_list_7d__v0.pipe @@ -1,15 +1,12 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT * FROM mv__http_7d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} ORDER BY cronTimestamp DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_list_7d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_list_7d__v1.pipe index 934891dc..67dd0dbd 100644 --- a/packages/tinybird/endpoints/endpoint__http_list_7d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_list_7d__v1.pipe @@ -1,19 +1,17 @@ -TAGS "http" +TOKEN "endpoint__http_list_7d__v1_endpoint_read_3587" READ NODE endpoint SQL > - % - SELECT * FROM mv__http_7d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if defined(fromDate) %} - AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) - {% end %} - {% if defined(toDate) %} - AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) - {% end %} - ORDER BY time DESC +% +SELECT * +FROM mv__http_7d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if defined(fromDate) %} AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) {% end %} + {% if defined(toDate) %} AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) {% end %} +ORDER BY time DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_14d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_14d__v0.pipe similarity index 86% rename from packages/tinybird/endpoints/endpoint__http_metrics_14d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_14d__v0.pipe index f32a91a7..0fe9dd53 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_14d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_14d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT round(quantile(0.50)(latency)) as p50Latency, round(quantile(0.75)(latency)) as p75Latency, @@ -18,6 +14,7 @@ SQL > FROM mv__http_14d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) UNION ALL SELECT @@ -32,8 +29,10 @@ SQL > FROM mv__http_30d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 28 DAY, 3) AND time < toDateTime64(now() - INTERVAL 14 DAY, 3) +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_14d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_14d__v1.pipe index f3e47727..d5ea3ee7 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_14d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_14d__v1.pipe @@ -1,42 +1,44 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_14d__v1_endpoint_read_3605" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__http_14d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM mv__http_30d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 28 DAY, 3) - AND time < toDateTime64(now() - INTERVAL 14 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM mv__http_14d__v1 + WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM mv__http_30d__v1 + WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 28 DAY, 3) + AND time < toDateTime64(now() - INTERVAL 14 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_1d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_1d__v0.pipe similarity index 50% rename from packages/tinybird/endpoints/endpoint__http_metrics_1d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_1d__v0.pipe index cf79d736..8d65d059 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_1d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_1d__v0.pipe @@ -1,39 +1,38 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, + round(quantile(0.5)(latency), 0) as p50Latency, + round(quantile(0.75)(latency), 0) as p75Latency, + round(quantile(0.9)(latency), 0) as p90Latency, + round(quantile(0.95)(latency), 0) as p95Latency, + round(quantile(0.99)(latency), 0) as p99Latency, count() as count, count(if(error = 0, 1, NULL)) AS ok, max(cronTimestamp) AS lastTimestamp FROM mv__http_1d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 1 DAY, 3) UNION ALL SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, + round(quantile(0.5)(latency), 0) as p50Latency, + round(quantile(0.75)(latency), 0) as p75Latency, + round(quantile(0.9)(latency), 0) as p90Latency, + round(quantile(0.95)(latency), 0) as p95Latency, + round(quantile(0.99)(latency), 0) as p99Latency, count() as count, count(if(error = 0, 1, NULL)) AS ok, NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant FROM mv__http_7d__v0 -- REMINDER: this will increase the processed data compared to 3d WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 2 DAY, 3) AND time < toDateTime64(now() - INTERVAL 1 DAY, 3) +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_1d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_1d__v1.pipe index db605bf1..7d9fca66 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_1d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_1d__v1.pipe @@ -1,43 +1,44 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_1d__v1_endpoint_read_2577" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__http_1d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 1 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM mv__http_7d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 2 DAY, 3) - AND time < toDateTime64(now() - INTERVAL 1 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM mv__http_1d__v1 + WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 1 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM mv__http_7d__v1 + WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 2 DAY, 3) + AND time < toDateTime64(now() - INTERVAL 1 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_30d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_30d__v1.pipe index 5e1b67d1..7e338a65 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_30d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_30d__v1.pipe @@ -1,9 +1,9 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_30d__v1_endpoint_read_7611" READ NODE endpoint SQL > - % +% SELECT round(quantile(0.50)(latency)) as p50Latency, round(quantile(0.75)(latency)) as p75Latency, @@ -39,4 +39,6 @@ SQL > AND time < toDateTime64(now() - INTERVAL 30 DAY, 3) {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} -TYPE ENDPOINT +TYPE endpoint + + diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_7d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_7d__v0.pipe similarity index 86% rename from packages/tinybird/endpoints/endpoint__http_metrics_7d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_7d__v0.pipe index fe7448e3..58eb8687 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_7d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT round(quantile(0.50)(latency)) as p50Latency, round(quantile(0.75)(latency)) as p75Latency, @@ -18,6 +14,7 @@ SQL > FROM mv__http_7d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 7 DAY, 3) UNION ALL SELECT @@ -32,8 +29,10 @@ SQL > FROM mv__http_14d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) AND time < toDateTime64(now() - INTERVAL 7 DAY, 3) +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_7d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_7d__v1.pipe index 06540408..2785f5a2 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_7d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_7d__v1.pipe @@ -1,42 +1,44 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_7d__v1_endpoint_read_5469" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__http_7d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 7 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM mv__http_14d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) - AND time < toDateTime64(now() - INTERVAL 7 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM mv__http_7d__v1 + WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 7 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM mv__http_14d__v1 + WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) + AND time < toDateTime64(now() - INTERVAL 7 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_90d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_90d__v1.pipe index af136418..4af8b346 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_90d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_90d__v1.pipe @@ -1,39 +1,41 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_90d__v1_endpoint_read_2698" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__http_90d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 90 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - -- the previous 90d window (90-180d ago) is past the 90d MV TTL, so there's no - -- real comparison data. emit an empty row to keep the 2-row contract; count 0 - -- makes the client suppress the trend badge (NaN). - SELECT - 0 AS p50Latency, - 0 AS p75Latency, - 0 AS p90Latency, - 0 AS p95Latency, - 0 AS p99Latency, - 0 AS count, - 0 AS success, - 0 AS degraded, - 0 AS error, - NULL AS lastTimestamp +% +SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp +FROM mv__http_90d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 90 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +UNION ALL +-- the previous 90d window (90-180d ago) is past the 90d MV TTL, so there's no +-- real comparison data. emit an empty row to keep the 2-row contract; count 0 +-- makes the client suppress the trend badge (NaN). +SELECT + 0 AS p50Latency, + 0 AS p75Latency, + 0 AS p90Latency, + 0 AS p95Latency, + 0 AS p99Latency, + 0 AS count, + 0 AS success, + 0 AS degraded, + 0 AS error, + NULL AS lastTimestamp + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_14d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_14d__v0.pipe similarity index 87% rename from packages/tinybird/endpoints/endpoint__http_metrics_by_interval_14d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_by_interval_14d__v0.pipe index a738bbcb..5873b9f2 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_14d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_14d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT region, toStartOfInterval( @@ -21,8 +17,10 @@ SQL > FROM mv__http_14d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY h, region ORDER BY h DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_1d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_1d__v0.pipe similarity index 87% rename from packages/tinybird/endpoints/endpoint__http_metrics_by_interval_1d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_by_interval_1d__v0.pipe index 3ea88c6a..78b7a28a 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_1d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_1d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT region, toStartOfInterval( @@ -21,8 +17,10 @@ SQL > FROM mv__http_1d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY h, region ORDER BY h DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_7d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_7d__v0.pipe similarity index 94% rename from packages/tinybird/endpoints/endpoint__http_metrics_by_interval_7d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_by_interval_7d__v0.pipe index 342494b1..1ba066ec 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_by_interval_7d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT region, toStartOfInterval( @@ -24,5 +20,6 @@ SQL > GROUP BY h, region ORDER BY h DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_by_region_14d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_by_region_14d__v0.pipe similarity index 82% rename from packages/tinybird/endpoints/endpoint__http_metrics_by_region_14d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_by_region_14d__v0.pipe index 2e985e4b..0dbd1f29 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_by_region_14d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_by_region_14d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT region, round(quantile(0.5)(latency)) as p50Latency, @@ -18,11 +14,9 @@ SQL > FROM mv__http_14d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY region +TYPE endpoint - - - -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_by_region_1d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_by_region_1d__v0.pipe similarity index 82% rename from packages/tinybird/endpoints/endpoint__http_metrics_by_region_1d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_by_region_1d__v0.pipe index 28572163..606a00e8 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_by_region_1d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_by_region_1d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT region, round(quantile(0.5)(latency)) as p50Latency, @@ -18,8 +14,9 @@ SQL > FROM mv__http_1d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY region +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_by_region_7d.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_by_region_7d__v0.pipe similarity index 82% rename from packages/tinybird/endpoints/endpoint__http_metrics_by_region_7d.pipe rename to packages/tinybird/endpoints/endpoint__http_metrics_by_region_7d__v0.pipe index dfe49ac2..17cbe044 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_by_region_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_by_region_7d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT region, round(quantile(0.5)(latency)) as p50Latency, @@ -18,8 +14,9 @@ SQL > FROM mv__http_7d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY region +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_global_1d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_global_1d__v0.pipe index d7139025..0b84fefa 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_global_1d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_global_1d__v0.pipe @@ -1,25 +1,24 @@ -VERSION 0 - -TAGS "http" +TOKEN "endpoint__http_metrics_global_1d__v1_endpoint_read_4114" READ NODE endpoint SQL > - % - SELECT - round(min(latency), 0) as minLatency, - round(max(latency), 0) as maxLatency, - round(quantile(0.5)(latency), 0) as p50Latency, - round(quantile(0.75)(latency), 0) as p75Latency, - round(quantile(0.9)(latency), 0) as p90Latency, - round(quantile(0.95)(latency), 0) as p95Latency, - round(quantile(0.99)(latency), 0) as p99Latency, - max(cronTimestamp) as lastTimestamp, - count() as count, - monitorId - FROM mv__http_1d__v1 - WHERE monitorId IN {{ Array(monitorIds, 'String', '1') }} - GROUP BY monitorId +% +SELECT + round(min(latency), 0) as minLatency, + round(max(latency), 0) as maxLatency, + round(quantile(0.5)(latency), 0) as p50Latency, + round(quantile(0.75)(latency), 0) as p75Latency, + round(quantile(0.9)(latency), 0) as p90Latency, + round(quantile(0.95)(latency), 0) as p95Latency, + round(quantile(0.99)(latency), 0) as p99Latency, + max(cronTimestamp) as lastTimestamp, + count() as count, + monitorId +FROM mv__http_1d__v0 +WHERE monitorId IN {{ Array(monitorIds, 'String', '1') }} +GROUP BY monitorId + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_latency_1d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_latency_1d__v1.pipe index d8288ac9..cdc9de5f 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_latency_1d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_latency_1d__v1.pipe @@ -1,24 +1,25 @@ -TAGS "tcp" +TOKEN "endpoint__http_metrics_latency_1d__v1_endpoint_read_0329" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_1d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_1d__v0 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_latency_1d_multi__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_latency_1d_multi__v1.pipe index 746c76ca..176283d2 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_latency_1d_multi__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_latency_1d_multi__v1.pipe @@ -1,25 +1,26 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_latency_1d_multi__v1_endpoint_read_2067" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - monitorId, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_1d__v1 - WHERE - monitorId IN {{ Array(monitorIds, 'String', '1,666') }} - GROUP BY h, monitorId - ORDER BY h ASC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + monitorId, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_1d__v0 +WHERE + monitorId IN {{ Array(monitorIds, 'String', '1,666') }} +GROUP BY h, monitorId +ORDER BY h ASC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_latency_30d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_latency_30d__v1.pipe index 7159a465..cd51b62b 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_latency_30d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_latency_30d__v1.pipe @@ -1,24 +1,26 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_latency_30d__v1_endpoint_read_9465" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_30d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_30d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_latency_7d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_latency_7d__v1.pipe index 5631bb5d..9dfd7f06 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_latency_7d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_latency_7d__v1.pipe @@ -1,24 +1,25 @@ -TAGS "tcp" +TOKEN "endpoint__http_metrics_latency_7d__v1_endpoint_read_5816" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_7d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_7d__v0 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_latency_90d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_latency_90d__v1.pipe index b7651b8f..5bb51950 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_latency_90d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_latency_90d__v1.pipe @@ -1,24 +1,26 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_latency_90d__v1_endpoint_read_3285" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_90d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_90d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_regions_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_regions_14d__v0.pipe index b3e70b58..57cd926e 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_regions_14d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_regions_14d__v0.pipe @@ -1,24 +1,27 @@ +TOKEN "endpoint__http_metrics_regions_14d__v0_endpoint_read_2934" READ + NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_14d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_14d__v0 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_regions_1d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_regions_1d__v0.pipe index a65352bb..980e4e45 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_regions_1d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_regions_1d__v0.pipe @@ -1,24 +1,27 @@ +TOKEN "endpoint_http_metrics_regions_1d__v0_endpoint_read_9756" READ + NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_1d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_1d__v0 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_regions_30d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_regions_30d__v0.pipe index 2bcf3d7c..81681f1b 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_regions_30d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_regions_30d__v0.pipe @@ -1,25 +1,27 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_regions_30d__v0_endpoint_read_1538" READ NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_30d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_30d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_regions_7d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_regions_7d__v0.pipe index 0b2a50e7..2193b918 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_regions_7d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_regions_7d__v0.pipe @@ -1,24 +1,27 @@ +TOKEN "endpoint__http_metrics_regions_7d__v0_endpoint_read_7523" READ + NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_7d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_7d__v0 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} +{% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_metrics_regions_90d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_metrics_regions_90d__v0.pipe index 891fe318..9554d710 100644 --- a/packages/tinybird/endpoints/endpoint__http_metrics_regions_90d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__http_metrics_regions_90d__v0.pipe @@ -1,25 +1,27 @@ -TAGS "http" +TOKEN "endpoint__http_metrics_regions_90d__v0_endpoint_read_4964" READ NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__http_90d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__http_90d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_status_14d.pipe b/packages/tinybird/endpoints/endpoint__http_status_14d.pipe deleted file mode 100644 index 4e18069a..00000000 --- a/packages/tinybird/endpoints/endpoint__http_status_14d.pipe +++ /dev/null @@ -1,26 +0,0 @@ -VERSION 0 - -TAGS "http" - -NODE endpoint -SQL > - - % - SELECT - time as day, - countMerge(total) as total, - countMerge(success) as success, - countMerge(error) as error, - countMerge(degraded) as degraded - FROM mv__http_status_14d__v0 - WHERE monitorId = {{ String(monitorId, '1', required=True) }} - GROUP BY day - ORDER BY day DESC - WITH FILL - FROM - toStartOfDay(toStartOfDay(toTimeZone(now(), 'UTC'))) - TO toStartOfDay(date_sub(DAY, 14, now())) STEP INTERVAL -1 DAY - LIMIT {{ Int16(days, 14) }} - - -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_status_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_status_14d__v0.pipe new file mode 100644 index 00000000..500ecd18 --- /dev/null +++ b/packages/tinybird/endpoints/endpoint__http_status_14d__v0.pipe @@ -0,0 +1,25 @@ +TOKEN "endpoint__http_status_14d__v0_endpoint_read_8823" READ + +NODE endpoint +SQL > + +% +SELECT + time as day, + countMerge(total) as total, + countMerge(success) as success, + countMerge(error) as error, + countMerge(degraded) as degraded +FROM mv__http_status_14d__v0 +WHERE monitorId = {{ String(monitorId, '1', required=True) }} +GROUP BY day +ORDER BY day DESC +WITH FILL +FROM + toStartOfDay(toStartOfDay(toTimeZone(now(), 'UTC'))) + TO toStartOfDay(date_sub(DAY, 14, now())) STEP INTERVAL -1 DAY +LIMIT {{ Int16(days, 14) }} + +TYPE endpoint + + diff --git a/packages/tinybird/endpoints/endpoint__http_status_45d.pipe b/packages/tinybird/endpoints/endpoint__http_status_45d__v0.pipe similarity index 91% rename from packages/tinybird/endpoints/endpoint__http_status_45d.pipe rename to packages/tinybird/endpoints/endpoint__http_status_45d__v0.pipe index b297fdc5..a6f26085 100644 --- a/packages/tinybird/endpoints/endpoint__http_status_45d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_status_45d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT time as day, countMerge(count) as count, countMerge(ok) as ok FROM mv__http_status_45d__v0 WHERE @@ -20,5 +16,6 @@ SQL > ) STEP INTERVAL -1 DAY LIMIT {{ Int16(days, 45) }} +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_status_45d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_status_45d__v1.pipe index c6cdcb1e..5b9b99fd 100644 --- a/packages/tinybird/endpoints/endpoint__http_status_45d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_status_45d__v1.pipe @@ -1,20 +1,21 @@ -TAGS "http" +TOKEN "endpoint__http_status_45d__v0_5279_dup_endpoint_read_1013" READ NODE endpoint SQL > - % - SELECT - time as day, - monitorId, - countMerge(count) as count, - countMerge(success) as ok, - countMerge(error) as error, - countMerge(degraded) as degraded - FROM mv__http_status_45d__v1 - WHERE monitorId IN {{ Array(monitorIds, 'String', '1,666') }} - GROUP BY day, monitorId - ORDER BY day DESC +% +SELECT + time as day, + monitorId, + countMerge(count) as count, + countMerge(success) as ok, + countMerge(error) as error, + countMerge(degraded) as degraded +FROM mv__http_status_45d__v1 +WHERE monitorId IN {{ Array(monitorIds, 'String', '1,666') }} +GROUP BY day, monitorId +ORDER BY day DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_status_7d.pipe b/packages/tinybird/endpoints/endpoint__http_status_7d__v0.pipe similarity index 91% rename from packages/tinybird/endpoints/endpoint__http_status_7d.pipe rename to packages/tinybird/endpoints/endpoint__http_status_7d__v0.pipe index 1f1c2a3f..af25c5ee 100644 --- a/packages/tinybird/endpoints/endpoint__http_status_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__http_status_7d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS http - NODE endpoint SQL > - % +% SELECT time as day, countMerge(count) as count, countMerge(ok) as ok FROM mv__http_status_7d__v0 WHERE @@ -19,5 +15,6 @@ SQL > date_sub(DAY, 7, now()) ) STEP INTERVAL -1 DAY +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_timing_phases_14d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_timing_phases_14d__v1.pipe index 186b65e4..7dacb40c 100644 --- a/packages/tinybird/endpoints/endpoint__http_timing_phases_14d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_timing_phases_14d__v1.pipe @@ -1,39 +1,42 @@ -NODE endpoint__http_timing_phases_14d__v1_0 +TOKEN "endpoint__http_timing_phases_14d__v1_endpoint_read_2967" READ + +NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ Int64(interval, 30) }} MINUTE) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.5)(dns)) as p50Dns, - round(quantile(0.5)(firstByte)) as p50Ttfb, - round(quantile(0.5)(transfer)) as p50Transfer, - round(quantile(0.5)(connect)) as p50Connect, - round(quantile(0.5)(tls)) as p50Tls, - round(quantile(0.75)(dns)) as p75Dns, - round(quantile(0.75)(firstByte)) as p75Ttfb, - round(quantile(0.75)(transfer)) as p75Transfer, - round(quantile(0.75)(connect)) as p75Connect, - round(quantile(0.75)(tls)) as p75Tls, - round(quantile(0.90)(dns)) as p90Dns, - round(quantile(0.90)(firstByte)) as p90Ttfb, - round(quantile(0.90)(transfer)) as p90Transfer, - round(quantile(0.90)(connect)) as p90Connect, - round(quantile(0.90)(tls)) as p90Tls, - round(quantile(0.95)(dns)) as p95Dns, - round(quantile(0.95)(firstByte)) as p95Ttfb, - round(quantile(0.95)(transfer)) as p95Transfer, - round(quantile(0.95)(connect)) as p95Connect, - round(quantile(0.95)(tls)) as p95Tls, - round(quantile(0.99)(dns)) as p99Dns, - round(quantile(0.99)(firstByte)) as p99Ttfb, - round(quantile(0.99)(transfer)) as p99Transfer, - round(quantile(0.99)(connect)) as p99Connect, - round(quantile(0.99)(tls)) as p99Tls - FROM mv__http_timing_phases_14d__v1 - WHERE monitorId = {{ String(monitorId, '141', required=True) }} - GROUP BY h - ORDER BY h ASC +% +SELECT + toStartOfInterval(time, INTERVAL {{ Int64(interval, 30) }} MINUTE) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.5)(dns)) as p50Dns, + round(quantile(0.5)(firstByte)) as p50Ttfb, + round(quantile(0.5)(transfer)) as p50Transfer, + round(quantile(0.5)(connect)) as p50Connect, + round(quantile(0.5)(tls)) as p50Tls, + round(quantile(0.75)(dns)) as p75Dns, + round(quantile(0.75)(firstByte)) as p75Ttfb, + round(quantile(0.75)(transfer)) as p75Transfer, + round(quantile(0.75)(connect)) as p75Connect, + round(quantile(0.75)(tls)) as p75Tls, + round(quantile(0.90)(dns)) as p90Dns, + round(quantile(0.90)(firstByte)) as p90Ttfb, + round(quantile(0.90)(transfer)) as p90Transfer, + round(quantile(0.90)(connect)) as p90Connect, + round(quantile(0.90)(tls)) as p90Tls, + round(quantile(0.95)(dns)) as p95Dns, + round(quantile(0.95)(firstByte)) as p95Ttfb, + round(quantile(0.95)(transfer)) as p95Transfer, + round(quantile(0.95)(connect)) as p95Connect, + round(quantile(0.95)(tls)) as p95Tls, + round(quantile(0.99)(dns)) as p99Dns, + round(quantile(0.99)(firstByte)) as p99Ttfb, + round(quantile(0.99)(transfer)) as p99Transfer, + round(quantile(0.99)(connect)) as p99Connect, + round(quantile(0.99)(tls)) as p99Tls +FROM mv__http_timing_phases_14d__v1 +WHERE monitorId = {{ String(monitorId, '141', required=True) }} +GROUP BY h +ORDER BY h ASC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_timing_phases_30d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_timing_phases_30d__v1.pipe index b44386cd..d86a115d 100644 --- a/packages/tinybird/endpoints/endpoint__http_timing_phases_30d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_timing_phases_30d__v1.pipe @@ -1,40 +1,44 @@ +TOKEN "endpoint__http_timing_phases_30d__v1_endpoint_read_9641" READ + NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ Int64(interval, 1440) }} MINUTE) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.5)(dns)) as p50Dns, - round(quantile(0.5)(firstByte)) as p50Ttfb, - round(quantile(0.5)(transfer)) as p50Transfer, - round(quantile(0.5)(connect)) as p50Connect, - round(quantile(0.5)(tls)) as p50Tls, - round(quantile(0.75)(dns)) as p75Dns, - round(quantile(0.75)(firstByte)) as p75Ttfb, - round(quantile(0.75)(transfer)) as p75Transfer, - round(quantile(0.75)(connect)) as p75Connect, - round(quantile(0.75)(tls)) as p75Tls, - round(quantile(0.90)(dns)) as p90Dns, - round(quantile(0.90)(firstByte)) as p90Ttfb, - round(quantile(0.90)(transfer)) as p90Transfer, - round(quantile(0.90)(connect)) as p90Connect, - round(quantile(0.90)(tls)) as p90Tls, - round(quantile(0.95)(dns)) as p95Dns, - round(quantile(0.95)(firstByte)) as p95Ttfb, - round(quantile(0.95)(transfer)) as p95Transfer, - round(quantile(0.95)(connect)) as p95Connect, - round(quantile(0.95)(tls)) as p95Tls, - round(quantile(0.99)(dns)) as p99Dns, - round(quantile(0.99)(firstByte)) as p99Ttfb, - round(quantile(0.99)(transfer)) as p99Transfer, - round(quantile(0.99)(connect)) as p99Connect, - round(quantile(0.99)(tls)) as p99Tls - FROM mv__http_timing_phases_90d__v1 - WHERE - monitorId = {{ String(monitorId, '141', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 30 DAY, 3) - GROUP BY h - ORDER BY h ASC +% +SELECT + toStartOfInterval(time, INTERVAL {{ Int64(interval, 1440) }} MINUTE) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.5)(dns)) as p50Dns, + round(quantile(0.5)(firstByte)) as p50Ttfb, + round(quantile(0.5)(transfer)) as p50Transfer, + round(quantile(0.5)(connect)) as p50Connect, + round(quantile(0.5)(tls)) as p50Tls, + round(quantile(0.75)(dns)) as p75Dns, + round(quantile(0.75)(firstByte)) as p75Ttfb, + round(quantile(0.75)(transfer)) as p75Transfer, + round(quantile(0.75)(connect)) as p75Connect, + round(quantile(0.75)(tls)) as p75Tls, + round(quantile(0.90)(dns)) as p90Dns, + round(quantile(0.90)(firstByte)) as p90Ttfb, + round(quantile(0.90)(transfer)) as p90Transfer, + round(quantile(0.90)(connect)) as p90Connect, + round(quantile(0.90)(tls)) as p90Tls, + round(quantile(0.95)(dns)) as p95Dns, + round(quantile(0.95)(firstByte)) as p95Ttfb, + round(quantile(0.95)(transfer)) as p95Transfer, + round(quantile(0.95)(connect)) as p95Connect, + round(quantile(0.95)(tls)) as p95Tls, + round(quantile(0.99)(dns)) as p99Dns, + round(quantile(0.99)(firstByte)) as p99Ttfb, + round(quantile(0.99)(transfer)) as p99Transfer, + round(quantile(0.99)(connect)) as p99Connect, + round(quantile(0.99)(tls)) as p99Tls +FROM mv__http_timing_phases_90d__v1 +WHERE + monitorId = {{ String(monitorId, '141', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 30 DAY, 3) +GROUP BY h +ORDER BY h ASC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_timing_phases_90d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_timing_phases_90d__v1.pipe index e6209fff..643981ce 100644 --- a/packages/tinybird/endpoints/endpoint__http_timing_phases_90d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_timing_phases_90d__v1.pipe @@ -1,38 +1,42 @@ +TOKEN "endpoint__http_timing_phases_90d__v1_endpoint_read_7261" READ + NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ Int64(interval, 1440) }} MINUTE) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.5)(dns)) as p50Dns, - round(quantile(0.5)(firstByte)) as p50Ttfb, - round(quantile(0.5)(transfer)) as p50Transfer, - round(quantile(0.5)(connect)) as p50Connect, - round(quantile(0.5)(tls)) as p50Tls, - round(quantile(0.75)(dns)) as p75Dns, - round(quantile(0.75)(firstByte)) as p75Ttfb, - round(quantile(0.75)(transfer)) as p75Transfer, - round(quantile(0.75)(connect)) as p75Connect, - round(quantile(0.75)(tls)) as p75Tls, - round(quantile(0.90)(dns)) as p90Dns, - round(quantile(0.90)(firstByte)) as p90Ttfb, - round(quantile(0.90)(transfer)) as p90Transfer, - round(quantile(0.90)(connect)) as p90Connect, - round(quantile(0.90)(tls)) as p90Tls, - round(quantile(0.95)(dns)) as p95Dns, - round(quantile(0.95)(firstByte)) as p95Ttfb, - round(quantile(0.95)(transfer)) as p95Transfer, - round(quantile(0.95)(connect)) as p95Connect, - round(quantile(0.95)(tls)) as p95Tls, - round(quantile(0.99)(dns)) as p99Dns, - round(quantile(0.99)(firstByte)) as p99Ttfb, - round(quantile(0.99)(transfer)) as p99Transfer, - round(quantile(0.99)(connect)) as p99Connect, - round(quantile(0.99)(tls)) as p99Tls - FROM mv__http_timing_phases_90d__v1 - WHERE monitorId = {{ String(monitorId, '141', required=True) }} - GROUP BY h - ORDER BY h ASC +% +SELECT + toStartOfInterval(time, INTERVAL {{ Int64(interval, 1440) }} MINUTE) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.5)(dns)) as p50Dns, + round(quantile(0.5)(firstByte)) as p50Ttfb, + round(quantile(0.5)(transfer)) as p50Transfer, + round(quantile(0.5)(connect)) as p50Connect, + round(quantile(0.5)(tls)) as p50Tls, + round(quantile(0.75)(dns)) as p75Dns, + round(quantile(0.75)(firstByte)) as p75Ttfb, + round(quantile(0.75)(transfer)) as p75Transfer, + round(quantile(0.75)(connect)) as p75Connect, + round(quantile(0.75)(tls)) as p75Tls, + round(quantile(0.90)(dns)) as p90Dns, + round(quantile(0.90)(firstByte)) as p90Ttfb, + round(quantile(0.90)(transfer)) as p90Transfer, + round(quantile(0.90)(connect)) as p90Connect, + round(quantile(0.90)(tls)) as p90Tls, + round(quantile(0.95)(dns)) as p95Dns, + round(quantile(0.95)(firstByte)) as p95Ttfb, + round(quantile(0.95)(transfer)) as p95Transfer, + round(quantile(0.95)(connect)) as p95Connect, + round(quantile(0.95)(tls)) as p95Tls, + round(quantile(0.99)(dns)) as p99Dns, + round(quantile(0.99)(firstByte)) as p99Ttfb, + round(quantile(0.99)(transfer)) as p99Transfer, + round(quantile(0.99)(connect)) as p99Connect, + round(quantile(0.99)(tls)) as p99Tls +FROM mv__http_timing_phases_90d__v1 +WHERE monitorId = {{ String(monitorId, '141', required=True) }} +GROUP BY h +ORDER BY h ASC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_uptime_30d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_uptime_30d__v1.pipe index 44cf8261..0fcd8c17 100644 --- a/packages/tinybird/endpoints/endpoint__http_uptime_30d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_uptime_30d__v1.pipe @@ -1,22 +1,23 @@ -TAGS "http" +TOKEN "endpoint__http_uptime_30d__v1_endpoint_read_2714" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error - FROM mv__http_uptime_30d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} - {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY interval - ORDER BY interval DESC +% +SELECT + toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error +FROM mv__http_uptime_30d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} + {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY interval +ORDER BY interval DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_uptime_7d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_uptime_7d__v1.pipe index 357de666..ce04a188 100644 --- a/packages/tinybird/endpoints/endpoint__http_uptime_7d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_uptime_7d__v1.pipe @@ -1,22 +1,23 @@ -TAGS "http" +TOKEN "endpoint__http_uptime_7d__v1_endpoint_read_4195" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error - FROM mv__http_uptime_7d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} - {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY interval - ORDER BY interval DESC +% +SELECT + toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error +FROM mv__http_uptime_7d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} + {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY interval +ORDER BY interval DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_uptime_90d__v1.pipe b/packages/tinybird/endpoints/endpoint__http_uptime_90d__v1.pipe index fec0e098..b3151b3d 100644 --- a/packages/tinybird/endpoints/endpoint__http_uptime_90d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__http_uptime_90d__v1.pipe @@ -1,21 +1,25 @@ -TAGS "http" +TOKEN "endpoint__http_uptime_90d__v1_endpoint_read_2593" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ String(interval, '1440', required=True) }} minute) AS interval, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error - FROM mv__http_uptime_90d__v1 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} - {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY interval - ORDER BY interval DESC +% +SELECT + toStartOfInterval( + time, INTERVAL {{ String(interval, '1440', required=True) }} minute + ) AS interval, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error +FROM mv__http_uptime_90d__v1 +WHERE + monitorId = {{ String(monitorId, '1', required=True) }} + {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} + {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY interval +ORDER BY interval DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__http_workspace_30d__v0.pipe b/packages/tinybird/endpoints/endpoint__http_workspace_30d__v0.pipe index 028cbd22..7c603987 100644 --- a/packages/tinybird/endpoints/endpoint__http_workspace_30d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__http_workspace_30d__v0.pipe @@ -1,16 +1,17 @@ -TAGS "http" +TOKEN "endpoint__http_workspace_30d__v0_endpoint_read_9286" READ NODE endpoint SQL > - % - SELECT - time as day, - countMerge(count_state) as count - FROM mv__http_workspace_30d__v0 - WHERE workspaceId = {{ String(workspaceId, '1', required=True) }} - GROUP BY day - ORDER BY day DESC +% +SELECT + time as day, + countMerge(count_state) as count +FROM mv__http_workspace_30d__v0 +WHERE workspaceId = {{ String(workspaceId, '1', required=True) }} +GROUP BY day +ORDER BY day DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__stats_global.pipe b/packages/tinybird/endpoints/endpoint__stats_global.pipe deleted file mode 100644 index 4e68659e..00000000 --- a/packages/tinybird/endpoints/endpoint__stats_global.pipe +++ /dev/null @@ -1,25 +0,0 @@ -VERSION 0 - -NODE endpoint -SQL > - - % - SELECT COUNT(*) as count - FROM ping_response__v8 - {% if defined(period) %} - {% if String(period) == "1h" %} - WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 1 HOUR) * 1000 - {% elif String(period) == "10m" %} - WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 10 MINUTE) * 1000 - {% elif String(period) == "1d" %} - WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 1 DAY) * 1000 - {% elif String(period) == "1w" %} - WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 7 DAY) * 1000 - {% elif String(period) == "1m" %} - WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 1 MONTH) * 1000 - {% else %} - WHERE cronTimestamp > 0 - {% end %} - {% end %} - -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__stats_global__v0.pipe b/packages/tinybird/endpoints/endpoint__stats_global__v0.pipe new file mode 100644 index 00000000..20dd37b7 --- /dev/null +++ b/packages/tinybird/endpoints/endpoint__stats_global__v0.pipe @@ -0,0 +1,24 @@ +NODE endpoint +SQL > + +% +SELECT COUNT(*) as count +FROM ping_response__v8 +{% if defined(period) %} + {% if String(period) == "1h" %} + WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 1 HOUR) * 1000 + {% elif String(period) == "10m" %} + WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 10 MINUTE) * 1000 + {% elif String(period) == "1d" %} + WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 1 DAY) * 1000 + {% elif String(period) == "1w" %} + WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 7 DAY) * 1000 + {% elif String(period) == "1m" %} + WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 1 MONTH) * 1000 + {% else %} WHERE cronTimestamp > 0 + {% end %} +{% end %} + +TYPE endpoint + + diff --git a/packages/tinybird/endpoints/endpoint__tcp_get_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_get_14d__v0.pipe index 9f012b53..96eda6c1 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_get_14d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_get_14d__v0.pipe @@ -1,15 +1,16 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_get_14d__v0_endpoint_read_3805" READ NODE endpoint SQL > - % - SELECT * - FROM mv__tcp_full_14d__v0 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND id = {{ String(id, '', required=True) }} - ORDER BY time DESC +% + SELECT * + FROM mv__tcp_full_14d__v0 + WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND id = {{ String(id, '', required=True) }} + ORDER BY time DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_get_30d.pipe b/packages/tinybird/endpoints/endpoint__tcp_get_30d__v0.pipe similarity index 71% rename from packages/tinybird/endpoints/endpoint__tcp_get_30d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_get_30d__v0.pipe index a3812df1..09dce649 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_get_30d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_get_30d__v0.pipe @@ -1,19 +1,15 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT * FROM mv__tcp_full_30d__v0 WHERE - monitorId = {{ String(monitorId, '1', required=True) }} + monitorId = {{ String(monitorId, '4433', required=True) }} AND cronTimestamp = {{ Int64(cronTimestamp, 1709477432205, required=True) }} AND region = {{ String(region, 'ams', required=True) }} ORDER BY cronTimestamp DESC +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_list_14d.pipe b/packages/tinybird/endpoints/endpoint__tcp_list_14d__v0.pipe similarity index 80% rename from packages/tinybird/endpoints/endpoint__tcp_list_14d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_list_14d__v0.pipe index c3f42e52..ad92409f 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_list_14d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_list_14d__v0.pipe @@ -1,15 +1,12 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT * FROM mv__tcp_14d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} ORDER BY cronTimestamp DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_list_14d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_list_14d__v1.pipe index 36b1f34e..88a9ec74 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_list_14d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_list_14d__v1.pipe @@ -1,19 +1,21 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_list_14d__v1_endpoint_read_9213" READ NODE endpoint SQL > - % - SELECT * FROM mv__tcp_14d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - {% if defined(fromDate) %} - AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) - {% end %} - {% if defined(toDate) %} - AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) - {% end %} - ORDER BY time DESC +% +SELECT * +FROM mv__tcp_14d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if defined(fromDate) %} + AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) + {% end %} + {% if defined(toDate) %} + AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) + {% end %} +ORDER BY time DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_list_1d.pipe b/packages/tinybird/endpoints/endpoint__tcp_list_1d.pipe deleted file mode 100644 index 2d38ba1d..00000000 --- a/packages/tinybird/endpoints/endpoint__tcp_list_1d.pipe +++ /dev/null @@ -1,15 +0,0 @@ -VERSION 0 - -TAGS tcp - -NODE endpoint -SQL > - - % - SELECT * FROM mv__tcp_1d__v0 - WHERE - monitorId = {{ String(monitorId, '1', required=True) }} - ORDER BY cronTimestamp DESC - - -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_list_1d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_list_1d__v0.pipe new file mode 100644 index 00000000..cb154d14 --- /dev/null +++ b/packages/tinybird/endpoints/endpoint__tcp_list_1d__v0.pipe @@ -0,0 +1,12 @@ +NODE endpoint +SQL > + +% + SELECT * FROM mv__tcp_1d__v0 + WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + ORDER BY cronTimestamp DESC + +TYPE endpoint + + diff --git a/packages/tinybird/endpoints/endpoint__tcp_list_1d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_list_1d__v1.pipe index fd1f5c2e..2f4f7fb6 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_list_1d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_list_1d__v1.pipe @@ -1,19 +1,21 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_list_1d__v1_endpoint_read_6247" READ NODE endpoint SQL > - % - SELECT * FROM mv__tcp_1d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - {% if defined(fromDate) %} - AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) - {% end %} - {% if defined(toDate) %} - AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) - {% end %} - ORDER BY time DESC +% +SELECT * +FROM mv__tcp_1d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if defined(fromDate) %} + AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) + {% end %} + {% if defined(toDate) %} + AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) + {% end %} +ORDER BY time DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_list_7d.pipe b/packages/tinybird/endpoints/endpoint__tcp_list_7d__v0.pipe similarity index 80% rename from packages/tinybird/endpoints/endpoint__tcp_list_7d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_list_7d__v0.pipe index a11c2433..4240d224 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_list_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_list_7d__v0.pipe @@ -1,15 +1,12 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT * FROM mv__tcp_7d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} ORDER BY cronTimestamp DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_list_7d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_list_7d__v1.pipe index def19386..ff202823 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_list_7d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_list_7d__v1.pipe @@ -1,19 +1,21 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_list_7d__v1_endpoint_read_7786" READ NODE endpoint SQL > - % - SELECT * FROM mv__tcp_7d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - {% if defined(fromDate) %} - AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) - {% end %} - {% if defined(toDate) %} - AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) - {% end %} - ORDER BY time DESC +% +SELECT * +FROM mv__tcp_7d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if defined(fromDate) %} + AND time >= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(fromDate) }}))) + {% end %} + {% if defined(toDate) %} + AND time <= toDateTime(fromUnixTimestamp64Milli(toInt64({{ String(toDate) }}))) + {% end %} +ORDER BY time DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_14d.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_14d__v0.pipe similarity index 88% rename from packages/tinybird/endpoints/endpoint__tcp_metrics_14d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_metrics_14d__v0.pipe index 6eb07095..dd0a94ec 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_14d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_14d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT round(quantile(0.50)(latency)) as p50Latency, round(quantile(0.75)(latency)) as p75Latency, @@ -18,6 +14,7 @@ SQL > FROM mv__tcp_14d__v0 WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} -- FIXME: we can reduce the data processed by using removing it entirely -- because the query is useless as we are in the 14d context -- TODO: check where we can reduce the data processed @@ -35,8 +32,10 @@ SQL > FROM mv__tcp_30d__v0 -- REMINDER: this will increase the processed data compared to 3d WHERE monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 28 DAY, 3) AND time < toDateTime64(now() - INTERVAL 14 DAY, 3) +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_14d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_14d__v1.pipe index 948a2e60..0aaa3dfb 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_14d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_14d__v1.pipe @@ -1,43 +1,49 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_14d__v1_endpoint_read_5043" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__tcp_14d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM mv__tcp_30d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 28 DAY, 3) - AND time < toDateTime64(now() - INTERVAL 14 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - - -TYPE ENDPOINT +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM mv__tcp_14d__v1 + WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM mv__tcp_30d__v1 + WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 28 DAY, 3) + AND time < toDateTime64(now() - INTERVAL 14 DAY, 3) + +TYPE endpoint + + + +NODE endpoint__tcp_metrics_14d__v1_1 +SQL > + + SELECT * FROM endpoint + + diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_1d.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_1d__v0.pipe similarity index 78% rename from packages/tinybird/endpoints/endpoint__tcp_metrics_1d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_metrics_1d__v0.pipe index 6eaeac95..b849de74 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_1d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_1d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT round(quantile(0.50)(latency)) as p50Latency, round(quantile(0.75)(latency)) as p75Latency, @@ -17,7 +13,8 @@ SQL > max(cronTimestamp) AS lastTimestamp FROM mv__tcp_1d__v0 WHERE - monitorId = {{ String(monitorId, '1', required=True) }} + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 1 DAY, 3) UNION ALL SELECT @@ -31,9 +28,11 @@ SQL > NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant FROM mv__tcp_7d__v0 -- REMINDER: this will increase the processed data compared to 3d WHERE - monitorId = {{ String(monitorId, '1', required=True) }} + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 2 DAY, 3) AND time < toDateTime64(now() - INTERVAL 1 DAY, 3) +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_1d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_1d__v1.pipe index adc2c9a9..779b4d89 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_1d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_1d__v1.pipe @@ -1,43 +1,44 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_1d__v1_endpoint_read_8831" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__tcp_1d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 1 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM mv__tcp_7d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 2 DAY, 3) - AND time < toDateTime64(now() - INTERVAL 1 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM mv__tcp_1d__v1 + WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 1 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM mv__tcp_7d__v1 + WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 2 DAY, 3) + AND time < toDateTime64(now() - INTERVAL 1 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_30d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_30d__v1.pipe index 7c74e819..6ee03eed 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_30d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_30d__v1.pipe @@ -1,42 +1,44 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_30d__v1_endpoint_read_2713" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__tcp_30d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 30 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp - FROM mv__tcp_90d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 60 DAY, 3) - AND time < toDateTime64(now() - INTERVAL 30 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% +SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp +FROM mv__tcp_30d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 30 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +UNION ALL +SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp +FROM mv__tcp_90d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 60 DAY, 3) + AND time < toDateTime64(now() - INTERVAL 30 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_7d.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_7d__v0.pipe similarity index 78% rename from packages/tinybird/endpoints/endpoint__tcp_metrics_7d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_metrics_7d__v0.pipe index 061bb022..37ae7408 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_7d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT round(quantile(0.50)(latency)) as p50Latency, round(quantile(0.75)(latency)) as p75Latency, @@ -17,7 +13,8 @@ SQL > max(cronTimestamp) AS lastTimestamp FROM mv__tcp_7d__v0 WHERE - monitorId = {{ String(monitorId, '1', required=True) }} + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 7 DAY, 3) UNION ALL SELECT @@ -31,9 +28,11 @@ SQL > NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant FROM mv__tcp_14d__v0 -- REMINDER: this will increase the processed data compared to 3d WHERE - monitorId = {{ String(monitorId, '1', required=True) }} + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) AND time < toDateTime64(now() - INTERVAL 7 DAY, 3) +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_7d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_7d__v1.pipe index e5193ad4..4a589d07 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_7d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_7d__v1.pipe @@ -1,43 +1,44 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_7d__v1_endpoint_read_9306" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__tcp_7d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 7 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - SELECT - round(quantile(0.50)(latency)) AS p50Latency, - round(quantile(0.75)(latency)) AS p75Latency, - round(quantile(0.90)(latency)) AS p90Latency, - round(quantile(0.95)(latency)) AS p95Latency, - round(quantile(0.99)(latency)) AS p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant - FROM mv__tcp_14d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) - AND time < toDateTime64(now() - INTERVAL 7 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +% + SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp + FROM mv__tcp_7d__v1 + WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 7 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + UNION ALL + SELECT + round(quantile(0.50)(latency)) AS p50Latency, + round(quantile(0.75)(latency)) AS p75Latency, + round(quantile(0.90)(latency)) AS p90Latency, + round(quantile(0.95)(latency)) AS p95Latency, + round(quantile(0.99)(latency)) AS p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant + FROM mv__tcp_14d__v1 + WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) + AND time < toDateTime64(now() - INTERVAL 7 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_90d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_90d__v1.pipe index d705347e..646aeacb 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_90d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_90d__v1.pipe @@ -1,39 +1,41 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_90d__v1_endpoint_read_1571" READ NODE endpoint SQL > - % - SELECT - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency, - count() as count, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error, - max(cronTimestamp) AS lastTimestamp - FROM mv__tcp_90d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - AND time >= toDateTime64(now() - INTERVAL 90 DAY, 3) - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - UNION ALL - -- the previous 90d window (90-180d ago) is past the 90d MV TTL, so there's no - -- real comparison data. emit an empty row to keep the 2-row contract; count 0 - -- makes the client suppress the trend badge (NaN). - SELECT - 0 AS p50Latency, - 0 AS p75Latency, - 0 AS p90Latency, - 0 AS p95Latency, - 0 AS p99Latency, - 0 AS count, - 0 AS success, - 0 AS degraded, - 0 AS error, - NULL AS lastTimestamp +% +SELECT + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency, + count() as count, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error, + max(cronTimestamp) AS lastTimestamp +FROM mv__tcp_90d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + AND time >= toDateTime64(now() - INTERVAL 90 DAY, 3) + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +UNION ALL +-- the previous 90d window (90-180d ago) is past the 90d MV TTL, so there's no +-- real comparison data. emit an empty row to keep the 2-row contract; count 0 +-- makes the client suppress the trend badge (NaN). +SELECT + 0 AS p50Latency, + 0 AS p75Latency, + 0 AS p90Latency, + 0 AS p95Latency, + 0 AS p99Latency, + 0 AS count, + 0 AS success, + 0 AS degraded, + 0 AS error, + NULL AS lastTimestamp + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_14d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_14d__v0.pipe index a49a2629..48bc9d97 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_14d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_14d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT region, toStartOfInterval( @@ -20,9 +16,11 @@ SQL > round(quantile(0.99)(latency)) as p99Latency FROM mv__tcp_14d__v0 WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} + monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY h, region ORDER BY h DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_1d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_1d__v0.pipe index 11e8771b..395dbc2f 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_1d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_1d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT region, toStartOfInterval( @@ -20,9 +16,11 @@ SQL > round(quantile(0.99)(latency)) as p99Latency FROM mv__tcp_1d__v0 WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} + monitorId = {{ String(monitorId, '1', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY h, region ORDER BY h DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_30d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_30d__v0.pipe index 637d3184..8884a0e3 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_30d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_30d__v0.pipe @@ -1,26 +1,25 @@ -VERSION 0 - -TAGS tcp +TOKEN "endpoint__tcp_metrics_by_interval_30d__v0_endpoint_read_8017" READ NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__tcp_30d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__tcp_30d__v1 +WHERE monitorId = {{ String(monitorId, '4433', required=True) }} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_7d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_7d__v0.pipe index d6e469f2..afbb97f2 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_7d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_7d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT region, toStartOfInterval( @@ -18,11 +14,13 @@ SQL > round(quantile(0.90)(latency)) as p90Latency, round(quantile(0.95)(latency)) as p95Latency, round(quantile(0.99)(latency)) as p99Latency - FROM mv__tcp_7d__v1 + FROM mv__tcp_7d__v0 WHERE monitorId = {{ String(monitorId, '4433', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY h, region ORDER BY h DESC +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_90d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_90d__v0.pipe index b5882f9a..11c47946 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_90d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_interval_90d__v0.pipe @@ -1,26 +1,25 @@ -VERSION 0 - -TAGS tcp +TOKEN "endpoint__tcp_metrics_by_interval_90d__v0_endpoint_read_0954" READ NODE endpoint SQL > - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__tcp_90d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - GROUP BY h, region - ORDER BY h DESC +% +SELECT + region, + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__tcp_90d__v1 +WHERE monitorId = {{ String(monitorId, '4433', required=True) }} +GROUP BY h, region +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_14d.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_14d__v0.pipe similarity index 71% rename from packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_14d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_14d__v0.pipe index 493ecd84..32c7efb6 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_14d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_14d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT region, round(quantile(0.5)(latency)) as p50Latency, @@ -17,9 +13,10 @@ SQL > count(if(error = 0, 1, NULL)) AS ok FROM mv__tcp_14d__v0 WHERE - monitorId = {{ String(monitorId, '1', required=True) }} + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY region +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_1d.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_1d__v0.pipe similarity index 71% rename from packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_1d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_1d__v0.pipe index 392f6f60..705aeeb8 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_1d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_1d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT region, round(quantile(0.5)(latency)) as p50Latency, @@ -17,9 +13,10 @@ SQL > count(if(error = 0, 1, NULL)) AS ok FROM mv__tcp_1d__v0 WHERE - monitorId = {{ String(monitorId, '1', required=True) }} + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY region +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_7d.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_7d__v0.pipe similarity index 71% rename from packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_7d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_7d__v0.pipe index 3b1cbaf0..e862d167 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_by_region_7d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT region, round(quantile(0.5)(latency)) as p50Latency, @@ -17,9 +13,10 @@ SQL > count(if(error = 0, 1, NULL)) AS ok FROM mv__tcp_7d__v0 WHERE - monitorId = {{ String(monitorId, '1', required=True) }} + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} GROUP BY region +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_global_1d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_global_1d__v0.pipe index 2f65ff43..90cef2ea 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_global_1d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_global_1d__v0.pipe @@ -1,25 +1,24 @@ -VERSION 0 - -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_global_1d__v0_endpoint_read_1387" READ NODE endpoint SQL > - % - SELECT - round(min(latency), 0) as minLatency, - round(max(latency), 0) as maxLatency, - round(quantile(0.5)(latency), 0) as p50Latency, - round(quantile(0.75)(latency), 0) as p75Latency, - round(quantile(0.9)(latency), 0) as p90Latency, - round(quantile(0.95)(latency), 0) as p95Latency, - round(quantile(0.99)(latency), 0) as p99Latency, - max(cronTimestamp) as lastTimestamp, - count() as count, - monitorId - FROM mv__tcp_1d__v0 - WHERE monitorId IN {{ Array(monitorIds, 'String', '4433') }} - GROUP BY monitorId +% +SELECT + round(min(latency), 0) as minLatency, + round(max(latency), 0) as maxLatency, + round(quantile(0.5)(latency), 0) as p50Latency, + round(quantile(0.75)(latency), 0) as p75Latency, + round(quantile(0.9)(latency), 0) as p90Latency, + round(quantile(0.95)(latency), 0) as p95Latency, + round(quantile(0.99)(latency), 0) as p99Latency, + max(cronTimestamp) as lastTimestamp, + count() as count, + monitorId +FROM mv__tcp_1d__v0 +WHERE monitorId IN {{ Array(monitorIds, 'String', '4433') }} +GROUP BY monitorId + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_1d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_1d__v1.pipe index 10d81b99..1ca170ac 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_1d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_1d__v1.pipe @@ -1,24 +1,25 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_latency_1d__v1_endpoint_read_1576" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__tcp_1d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__tcp_1d__v0 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_1d_multi__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_1d_multi__v1.pipe index 2f3b5e27..c7700060 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_1d_multi__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_1d_multi__v1.pipe @@ -1,25 +1,26 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_latency_1d_multi__v1_endpoint_read_4714" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - monitorId, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__tcp_1d__v1 - WHERE - monitorId IN {{ Array(monitorIds, 'String', '4433') }} - GROUP BY h, monitorId - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + monitorId, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__tcp_1d__v0 +WHERE + monitorId IN {{ Array(monitorIds, 'String', '4433') }} +GROUP BY h, monitorId +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_30d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_30d__v1.pipe index 84430f4f..18cbf09d 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_30d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_30d__v1.pipe @@ -1,23 +1,24 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_latency_30d__v1_endpoint_read_0676" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__tcp_30d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__tcp_30d__v1 +WHERE monitorId = {{ String(monitorId, '4433', required=True) }} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_7d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_7d__v1.pipe index b8b41812..f30e3c7e 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_7d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_7d__v1.pipe @@ -1,24 +1,25 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_latency_7d__v1_endpoint_read_6349" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__tcp_7d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 30) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__tcp_7d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_90d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_90d__v1.pipe index 912d4f49..1e4ce0ea 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_90d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_metrics_latency_90d__v1.pipe @@ -1,23 +1,24 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_metrics_latency_90d__v1_endpoint_read_2637" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval( - toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(quantile(0.50)(latency)) as p50Latency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.90)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM mv__tcp_90d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - GROUP BY h - ORDER BY h DESC +% +SELECT + toStartOfInterval( + toDateTime(cronTimestamp / 1000), INTERVAL {{ Int64(interval, 1440) }} MINUTE + ) as h, + toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, + round(quantile(0.50)(latency)) as p50Latency, + round(quantile(0.75)(latency)) as p75Latency, + round(quantile(0.90)(latency)) as p90Latency, + round(quantile(0.95)(latency)) as p95Latency, + round(quantile(0.99)(latency)) as p99Latency +FROM mv__tcp_90d__v1 +WHERE monitorId = {{ String(monitorId, '4433', required=True) }} +GROUP BY h +ORDER BY h DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_status_45d.pipe b/packages/tinybird/endpoints/endpoint__tcp_status_45d__v0.pipe similarity index 91% rename from packages/tinybird/endpoints/endpoint__tcp_status_45d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_status_45d__v0.pipe index 3f2f0b22..6f2929a4 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_status_45d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_status_45d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT time as day, countMerge(count) as count, countMerge(ok) as ok FROM mv__tcp_status_45d__v0 WHERE @@ -20,5 +16,6 @@ SQL > ) STEP INTERVAL -1 DAY LIMIT {{ Int16(days, 45) }} +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_status_45d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_status_45d__v1.pipe index 5d1b35d1..3258aabb 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_status_45d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_status_45d__v1.pipe @@ -1,20 +1,21 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_status_45d__v1_endpoint_read_8911" READ NODE endpoint SQL > - % - SELECT - time as day, - monitorId, - countMerge(count) as count, - countMerge(success) as ok, - countMerge(error) as error, - countMerge(degraded) as degraded - FROM mv__tcp_status_45d__v1 - WHERE monitorId IN {{ Array(monitorIds, 'String', '4433') }} - GROUP BY day, monitorId - ORDER BY day DESC +% +SELECT + time as day, + monitorId, + countMerge(count) as count, + countMerge(success) as ok, + countMerge(error) as error, + countMerge(degraded) as degraded +FROM mv__tcp_status_45d__v1 +WHERE monitorId IN {{ Array(monitorIds, 'String', '4433') }} +GROUP BY day, monitorId +ORDER BY day DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_status_7d.pipe b/packages/tinybird/endpoints/endpoint__tcp_status_7d__v0.pipe similarity index 91% rename from packages/tinybird/endpoints/endpoint__tcp_status_7d.pipe rename to packages/tinybird/endpoints/endpoint__tcp_status_7d__v0.pipe index 10169d50..f0bf349c 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_status_7d.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_status_7d__v0.pipe @@ -1,11 +1,7 @@ -VERSION 0 - -TAGS tcp - NODE endpoint SQL > - % +% SELECT time as day, countMerge(count) as count, countMerge(ok) as ok FROM mv__tcp_status_7d__v0 WHERE @@ -19,5 +15,6 @@ SQL > date_sub(DAY, 7, now()) ) STEP INTERVAL -1 DAY +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_uptime_30d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_uptime_30d__v1.pipe index 8218a8ba..d10b95fa 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_uptime_30d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_uptime_30d__v1.pipe @@ -1,22 +1,23 @@ -TAGS "http" +TOKEN "endpoint__tcp_uptime_30d__v1_endpoint_read_7238" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error - FROM mv__tcp_uptime_30d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} - {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY interval - ORDER BY interval DESC +% +SELECT + toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error +FROM mv__tcp_uptime_30d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} + {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY interval +ORDER BY interval DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_uptime_7d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_uptime_7d__v1.pipe index 146ad31d..69004b32 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_uptime_7d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_uptime_7d__v1.pipe @@ -1,22 +1,23 @@ -TAGS "http" +TOKEN "endpoint__tcp_uptime_7d__v1_endpoint_read_5726" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error - FROM mv__tcp_uptime_7d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} - {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY interval - ORDER BY interval DESC +% +SELECT + toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error +FROM mv__tcp_uptime_7d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} + {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY interval +ORDER BY interval DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_uptime_90d__v1.pipe b/packages/tinybird/endpoints/endpoint__tcp_uptime_90d__v1.pipe index 3eb0e49a..c06654b0 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_uptime_90d__v1.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_uptime_90d__v1.pipe @@ -1,21 +1,23 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_uptime_90d__v1_endpoint_read_5414" READ NODE endpoint SQL > - % - SELECT - toStartOfInterval(time, INTERVAL {{ String(interval, '1440', required=True) }} minute) AS interval, - countIf(requestStatus = 'success') AS success, - countIf(requestStatus = 'degraded') AS degraded, - countIf(requestStatus = 'error') AS error - FROM mv__tcp_uptime_90d__v1 - WHERE - monitorId = {{ String(monitorId, '4433', required=True) }} - {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} - {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} - {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} - GROUP BY interval - ORDER BY interval DESC +% +SELECT + toStartOfInterval(time, INTERVAL {{ String(interval, '30', required=True) }} minute) AS interval, + countIf(requestStatus = 'success') AS success, + countIf(requestStatus = 'degraded') AS degraded, + countIf(requestStatus = 'error') AS error +FROM mv__tcp_uptime_90d__v1 +WHERE + monitorId = {{ String(monitorId, '4433', required=True) }} + {% if fromDate %} AND time >= parseDateTimeBestEffortOrNull({{ String(fromDate) }}) {% end %} + {% if toDate %} AND time <= parseDateTimeBestEffortOrNull({{ String(toDate) }}) {% end %} + {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} +GROUP BY interval +ORDER BY interval DESC + +TYPE endpoint + -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint__tcp_workspace_30d__v0.pipe b/packages/tinybird/endpoints/endpoint__tcp_workspace_30d__v0.pipe index 27568470..db128d63 100644 --- a/packages/tinybird/endpoints/endpoint__tcp_workspace_30d__v0.pipe +++ b/packages/tinybird/endpoints/endpoint__tcp_workspace_30d__v0.pipe @@ -1,16 +1,17 @@ -TAGS "tcp" +TOKEN "endpoint__tcp_workspace_30d__v0_endpoint_read_0686" READ NODE endpoint SQL > - % - SELECT - time as day, - countMerge(count_state) as count - FROM mv__tcp_workspace_30d__v0 - WHERE workspaceId = {{ Int32(workspaceId, 1, required=True) }} - GROUP BY day - ORDER BY day DESC +% +SELECT + time as day, + countMerge(count_state) as count +FROM mv__tcp_workspace_30d__v0 +WHERE workspaceId = {{ Int32(workspaceId, 1, required=True) }} +GROUP BY day +ORDER BY day DESC + +TYPE endpoint -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint_audit_log.pipe b/packages/tinybird/endpoints/endpoint_audit_log.pipe deleted file mode 100644 index 4d42b16b..00000000 --- a/packages/tinybird/endpoints/endpoint_audit_log.pipe +++ /dev/null @@ -1,9 +0,0 @@ -VERSION 0 - -NODE endpoint_audit_pipe_0 -SQL > - - % SELECT * FROM audit_log__v0 WHERE id = {{ String(event_id, 1) }} ORDER BY timestamp DESC - - -TYPE ENDPOINT diff --git a/packages/tinybird/endpoints/endpoint_audit_log__v0.pipe b/packages/tinybird/endpoints/endpoint_audit_log__v0.pipe new file mode 100644 index 00000000..48c4e1cd --- /dev/null +++ b/packages/tinybird/endpoints/endpoint_audit_log__v0.pipe @@ -0,0 +1,8 @@ +NODE endpoint_audit_pipe_0 +SQL > + +% SELECT * FROM audit_log__v0 WHERE id = {{ String(eventId, 'monitor:2089') }} ORDER BY timestamp DESC + +TYPE endpoint + + diff --git a/packages/tinybird/endpoints/get_result_for_on_demand_check_http.pipe b/packages/tinybird/endpoints/get_result_for_on_demand_check_http.pipe new file mode 100644 index 00000000..79b0eecb --- /dev/null +++ b/packages/tinybird/endpoints/get_result_for_on_demand_check_http.pipe @@ -0,0 +1,27 @@ +TOKEN "getResultForOnDemandCheck_endpoint_read_7832" READ + +NODE get_result_for_on_demand_check_http_0 +SQL > + +% +SELECT + latency, + monitorId, + error, + region, + statusCode, + timestamp, + url, + workspaceId, + timing, + cronTimestamp +FROM mv__http_full_30d__v0 +where + cronTimestamp = {{ String(timestamp, '1729871694536') }} and + monitorId = {{ String(monitorId, '2260') }} + and url = {{ String(url , 'https://www.openstatus.dev/api/ping/edge') }} + order by cronTimestamp desc + +TYPE endpoint + + diff --git a/packages/tinybird/pipes/aggregate__dns_status_45d__v1.pipe b/packages/tinybird/materializations/aggregate__dns_status_45d__v1.pipe similarity index 95% rename from packages/tinybird/pipes/aggregate__dns_status_45d__v1.pipe rename to packages/tinybird/materializations/aggregate__dns_status_45d__v1.pipe index d74825f0..004bec54 100644 --- a/packages/tinybird/pipes/aggregate__dns_status_45d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__dns_status_45d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "statuspage, dns" - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__external_status_component_daily__v0.pipe b/packages/tinybird/materializations/aggregate__external_status_component__daily__v0.pipe similarity index 55% rename from packages/tinybird/pipes/aggregate__external_status_component_daily__v0.pipe rename to packages/tinybird/materializations/aggregate__external_status_component__daily__v0.pipe index 46dfdf2f..a50abf3c 100644 --- a/packages/tinybird/pipes/aggregate__external_status_component_daily__v0.pipe +++ b/packages/tinybird/materializations/aggregate__external_status_component__daily__v0.pipe @@ -1,22 +1,10 @@ -TAGS "external_status" - NODE aggregate SQL > SELECT toDate(toTimeZone(fromUnixTimestamp64Milli(fetched_at), 'UTC')) AS day, component_id, - argMaxState( - indicator, - toUInt8( - multiIf( - indicator = 'critical', 3, - indicator = 'major', 2, - indicator = 'minor', 1, - 0 - ) - ) - ) AS worst_indicator, + argMaxState(indicator, toUInt8(multiIf(indicator = 'critical', 3, indicator = 'major', 2, indicator = 'minor', 1, 0))) AS worst_indicator, maxState(toUInt8(status = 'under_maintenance')) AS had_maintenance, sumState(toUInt32(1)) AS snapshot_count FROM external_status_component__v0 @@ -26,3 +14,5 @@ SQL > TYPE materialized DATASOURCE mv__external_status_component_daily__v0 + + diff --git a/packages/tinybird/materializations/aggregate__external_status_daily__v0.pipe b/packages/tinybird/materializations/aggregate__external_status_daily__v0.pipe new file mode 100644 index 00000000..6c0696bc --- /dev/null +++ b/packages/tinybird/materializations/aggregate__external_status_daily__v0.pipe @@ -0,0 +1,28 @@ +NODE aggregate +SQL > + + SELECT + toDate(toTimeZone(fromUnixTimestamp64Milli(fetched_at), 'UTC')) AS day, + id, + argMaxState( + indicator, + toUInt8( + multiIf( + indicator = 'critical', 3, + indicator = 'major', 2, + indicator = 'minor', 1, + 0 + ) + ) + ) AS worst_indicator, + maxState(toUInt8(status = 'under_maintenance')) AS had_maintenance, + sumState(toUInt32(1)) AS snapshot_count + FROM external_status__v1 + GROUP BY + day, + id + +TYPE materialized +DATASOURCE mv__external_status_daily__v0 + + diff --git a/packages/tinybird/materializations/aggregate__http_14d__v0.pipe b/packages/tinybird/materializations/aggregate__http_14d__v0.pipe new file mode 100644 index 00000000..3c3e547d --- /dev/null +++ b/packages/tinybird/materializations/aggregate__http_14d__v0.pipe @@ -0,0 +1,20 @@ +NODE aggregate +SQL > + + SELECT + toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, + latency, + error, + region, + trigger, + statusCode, + timestamp, + cronTimestamp, + monitorId, + workspaceId + FROM ping_response__v8 + +TYPE materialized +DATASOURCE mv__http_14d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__http_14d__v1.pipe b/packages/tinybird/materializations/aggregate__http_14d__v1.pipe similarity index 96% rename from packages/tinybird/pipes/aggregate__http_14d__v1.pipe rename to packages/tinybird/materializations/aggregate__http_14d__v1.pipe index 5fc61ca8..1e9d2438 100644 --- a/packages/tinybird/pipes/aggregate__http_14d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__http_14d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "http" - NODE aggregate SQL > diff --git a/packages/tinybird/materializations/aggregate__http_1d__v0.pipe b/packages/tinybird/materializations/aggregate__http_1d__v0.pipe new file mode 100644 index 00000000..7c995fb6 --- /dev/null +++ b/packages/tinybird/materializations/aggregate__http_1d__v0.pipe @@ -0,0 +1,20 @@ +NODE aggregate +SQL > + + SELECT + toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, + latency, + error, + region, + trigger, + statusCode, + timestamp, + cronTimestamp, + monitorId, + workspaceId + FROM ping_response__v8 + +TYPE materialized +DATASOURCE mv__http_1d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__http_1d__v1.pipe b/packages/tinybird/materializations/aggregate__http_1d__v1.pipe similarity index 96% rename from packages/tinybird/pipes/aggregate__http_1d__v1.pipe rename to packages/tinybird/materializations/aggregate__http_1d__v1.pipe index ef054ccd..8facbd46 100644 --- a/packages/tinybird/pipes/aggregate__http_1d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__http_1d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "http" - NODE aggregate SQL > diff --git a/packages/tinybird/materializations/aggregate__http_30d__v0.pipe b/packages/tinybird/materializations/aggregate__http_30d__v0.pipe new file mode 100644 index 00000000..ffc98d09 --- /dev/null +++ b/packages/tinybird/materializations/aggregate__http_30d__v0.pipe @@ -0,0 +1,20 @@ +NODE aggregate +SQL > + + SELECT + toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, + latency, + error, + region, + trigger, + statusCode, + timestamp, + cronTimestamp, + monitorId, + workspaceId + FROM ping_response__v8 + +TYPE materialized +DATASOURCE mv__http_30d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__http_30d__v1.pipe b/packages/tinybird/materializations/aggregate__http_30d__v1.pipe similarity index 100% rename from packages/tinybird/pipes/aggregate__http_30d__v1.pipe rename to packages/tinybird/materializations/aggregate__http_30d__v1.pipe diff --git a/packages/tinybird/materializations/aggregate__http_7d__v0.pipe b/packages/tinybird/materializations/aggregate__http_7d__v0.pipe new file mode 100644 index 00000000..0421cafe --- /dev/null +++ b/packages/tinybird/materializations/aggregate__http_7d__v0.pipe @@ -0,0 +1,20 @@ +NODE aggregate +SQL > + + SELECT + toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, + latency, + error, + region, + trigger, + statusCode, + timestamp, + cronTimestamp, + monitorId, + workspaceId + FROM ping_response__v8 + +TYPE materialized +DATASOURCE mv__http_7d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__http_7d__v1.pipe b/packages/tinybird/materializations/aggregate__http_7d__v1.pipe similarity index 100% rename from packages/tinybird/pipes/aggregate__http_7d__v1.pipe rename to packages/tinybird/materializations/aggregate__http_7d__v1.pipe diff --git a/packages/tinybird/pipes/aggregate__http_90d__v1.pipe b/packages/tinybird/materializations/aggregate__http_90d__v1.pipe similarity index 99% rename from packages/tinybird/pipes/aggregate__http_90d__v1.pipe rename to packages/tinybird/materializations/aggregate__http_90d__v1.pipe index a184aed1..a92ea817 100644 --- a/packages/tinybird/pipes/aggregate__http_90d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__http_90d__v1.pipe @@ -17,3 +17,5 @@ SQL > TYPE materialized DATASOURCE mv__http_90d__v1 + + diff --git a/packages/tinybird/pipes/aggregate__http_full_14d__v0.pipe b/packages/tinybird/materializations/aggregate__http_full_14d__v0.pipe similarity index 50% rename from packages/tinybird/pipes/aggregate__http_full_14d__v0.pipe rename to packages/tinybird/materializations/aggregate__http_full_14d__v0.pipe index b4272eda..cfee2aaa 100644 --- a/packages/tinybird/pipes/aggregate__http_full_14d__v0.pipe +++ b/packages/tinybird/materializations/aggregate__http_full_14d__v0.pipe @@ -2,14 +2,29 @@ DESCRIPTION > Stores all the data from the http_response table for the last 30 days, mainly used for accessing the data details. -TAGS "http, full" - NODE aggregate SQL > SELECT toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, - * + latency, + monitorId, + region, + statusCode, + error, + timestamp, + url, + workspaceId, + cronTimestamp, + message, + timing, + headers, + assertions, + body, + trigger, + id, + requestStatus, + method FROM ping_response__v8 TYPE materialized diff --git a/packages/tinybird/pipes/aggregate__http_full_30d__v0.pipe b/packages/tinybird/materializations/aggregate__http_full_30d__v0.pipe similarity index 50% rename from packages/tinybird/pipes/aggregate__http_full_30d__v0.pipe rename to packages/tinybird/materializations/aggregate__http_full_30d__v0.pipe index 1402cda0..ed4c1815 100644 --- a/packages/tinybird/pipes/aggregate__http_full_30d__v0.pipe +++ b/packages/tinybird/materializations/aggregate__http_full_30d__v0.pipe @@ -2,14 +2,29 @@ DESCRIPTION > Stores all the data from the http_response table for the last 30 days, mainly used for accessing the data details. -TAGS "http, full" - NODE aggregate SQL > SELECT toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, - * + latency, + monitorId, + region, + statusCode, + error, + timestamp, + url, + workspaceId, + cronTimestamp, + message, + timing, + headers, + assertions, + body, + trigger, + id, + requestStatus, + method FROM ping_response__v8 TYPE materialized diff --git a/packages/tinybird/pipes/aggregate__http_status_14d.pipe b/packages/tinybird/materializations/aggregate__http_status_14d__v0.pipe similarity index 94% rename from packages/tinybird/pipes/aggregate__http_status_14d.pipe rename to packages/tinybird/materializations/aggregate__http_status_14d__v0.pipe index b9b48dba..7c0e4214 100644 --- a/packages/tinybird/pipes/aggregate__http_status_14d.pipe +++ b/packages/tinybird/materializations/aggregate__http_status_14d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS "http, statuspage" - NODE aggregate SQL > @@ -23,3 +19,5 @@ SQL > TYPE materialized DATASOURCE mv__http_status_14d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__http_status_45d.pipe b/packages/tinybird/materializations/aggregate__http_status_45d__v0.pipe similarity index 91% rename from packages/tinybird/pipes/aggregate__http_status_45d.pipe rename to packages/tinybird/materializations/aggregate__http_status_45d__v0.pipe index f502cc3e..c96b272a 100644 --- a/packages/tinybird/pipes/aggregate__http_status_45d.pipe +++ b/packages/tinybird/materializations/aggregate__http_status_45d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS http, statuspage - NODE aggregate SQL > @@ -17,3 +13,5 @@ SQL > TYPE materialized DATASOURCE mv__http_status_45d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__http_status_45d__v1.pipe b/packages/tinybird/materializations/aggregate__http_status_45d__v1.pipe similarity index 95% rename from packages/tinybird/pipes/aggregate__http_status_45d__v1.pipe rename to packages/tinybird/materializations/aggregate__http_status_45d__v1.pipe index 3b3905ac..9be3e1f5 100644 --- a/packages/tinybird/pipes/aggregate__http_status_45d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__http_status_45d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "http, statuspage" - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__http_status_7d.pipe b/packages/tinybird/materializations/aggregate__http_status_7d__v0.pipe similarity index 91% rename from packages/tinybird/pipes/aggregate__http_status_7d.pipe rename to packages/tinybird/materializations/aggregate__http_status_7d__v0.pipe index f2e76995..140ae2cf 100644 --- a/packages/tinybird/pipes/aggregate__http_status_7d.pipe +++ b/packages/tinybird/materializations/aggregate__http_status_7d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS http, statuspage - NODE aggregate SQL > @@ -17,3 +13,5 @@ SQL > TYPE materialized DATASOURCE mv__http_status_7d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__http_timing_phases_14d.pipe b/packages/tinybird/materializations/aggregate__http_timing_phases_14d__v1.pipe similarity index 100% rename from packages/tinybird/pipes/aggregate__http_timing_phases_14d.pipe rename to packages/tinybird/materializations/aggregate__http_timing_phases_14d__v1.pipe diff --git a/packages/tinybird/materializations/aggregate__http_timing_phases_90d__v1.pipe b/packages/tinybird/materializations/aggregate__http_timing_phases_90d__v1.pipe new file mode 100644 index 00000000..ca070ac4 --- /dev/null +++ b/packages/tinybird/materializations/aggregate__http_timing_phases_90d__v1.pipe @@ -0,0 +1,54 @@ +NODE aggregate +SQL > + + SELECT + toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, + latency, + region, + trigger, + statusCode, + monitorId, + workspaceId, + requestStatus, + + -- Compute actual durations from timing phases + if( + isNull (JSONExtractInt(timing, 'dnsStart')) OR isNull (JSONExtractInt(timing, 'dnsDone')), + NULL, + JSONExtractInt(timing, 'dnsDone') - JSONExtractInt(timing, 'dnsStart') + ) AS dns, + + if( + isNull (JSONExtractInt(timing, 'connectStart')) + OR isNull (JSONExtractInt(timing, 'connectDone')), + NULL, + JSONExtractInt(timing, 'connectDone') - JSONExtractInt(timing, 'connectStart') + ) AS connect, + + if( + isNull (JSONExtractInt(timing, 'tlsHandshakeStart')) + OR isNull (JSONExtractInt(timing, 'tlsHandshakeDone')), + NULL, + JSONExtractInt(timing, 'tlsHandshakeDone') - JSONExtractInt(timing, 'tlsHandshakeStart') + ) AS tls, + + if( + isNull (JSONExtractInt(timing, 'firstByteStart')) + OR isNull (JSONExtractInt(timing, 'firstByteDone')), + NULL, + JSONExtractInt(timing, 'firstByteDone') - JSONExtractInt(timing, 'firstByteStart') + ) AS firstByte, + + if( + isNull (JSONExtractInt(timing, 'transferStart')) + OR isNull (JSONExtractInt(timing, 'transferDone')), + NULL, + JSONExtractInt(timing, 'transferDone') - JSONExtractInt(timing, 'transferStart') + ) AS transfer + + FROM ping_response__v8 + +TYPE materialized +DATASOURCE mv__http_timing_phases_90d__v1 + + diff --git a/packages/tinybird/pipes/aggregate__http_uptime_30d.pipe b/packages/tinybird/materializations/aggregate__http_uptime_30d__v1.pipe similarity index 92% rename from packages/tinybird/pipes/aggregate__http_uptime_30d.pipe rename to packages/tinybird/materializations/aggregate__http_uptime_30d__v1.pipe index f00cf372..7761f78b 100644 --- a/packages/tinybird/pipes/aggregate__http_uptime_30d.pipe +++ b/packages/tinybird/materializations/aggregate__http_uptime_30d__v1.pipe @@ -1,7 +1,3 @@ -VERSION 1 - -TAGS http - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__http_uptime_7d__v1.pipe b/packages/tinybird/materializations/aggregate__http_uptime_7d__v1.pipe similarity index 100% rename from packages/tinybird/pipes/aggregate__http_uptime_7d__v1.pipe rename to packages/tinybird/materializations/aggregate__http_uptime_7d__v1.pipe diff --git a/packages/tinybird/materializations/aggregate__http_uptime_90d__v1.pipe b/packages/tinybird/materializations/aggregate__http_uptime_90d__v1.pipe new file mode 100644 index 00000000..fe221370 --- /dev/null +++ b/packages/tinybird/materializations/aggregate__http_uptime_90d__v1.pipe @@ -0,0 +1,15 @@ +NODE aggregate +SQL > + + SELECT + toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, + region, + requestStatus, + monitorId, + workspaceId + FROM ping_response__v8 + +TYPE materialized +DATASOURCE mv__http_uptime_90d__v1 + + diff --git a/packages/tinybird/pipes/aggregate__http_workspace_30d__v0.pipe b/packages/tinybird/materializations/aggregate__http_workspace_30d__v0.pipe similarity index 86% rename from packages/tinybird/pipes/aggregate__http_workspace_30d__v0.pipe rename to packages/tinybird/materializations/aggregate__http_workspace_30d__v0.pipe index 17f7f590..b1b5fa93 100644 --- a/packages/tinybird/pipes/aggregate__http_workspace_30d__v0.pipe +++ b/packages/tinybird/materializations/aggregate__http_workspace_30d__v0.pipe @@ -1,4 +1,4 @@ -TAGS "http" +TOKEN "aggregate__requests_30d__v0_endpoint_read_7187" READ NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__tcp_14d.pipe b/packages/tinybird/materializations/aggregate__tcp_14d__v0.pipe similarity index 94% rename from packages/tinybird/pipes/aggregate__tcp_14d.pipe rename to packages/tinybird/materializations/aggregate__tcp_14d__v0.pipe index f1db16e5..6a9c0c81 100644 --- a/packages/tinybird/pipes/aggregate__tcp_14d.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_14d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS tcp - NODE aggregate SQL > @@ -19,3 +15,5 @@ SQL > TYPE materialized DATASOURCE mv__tcp_14d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_14d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_14d__v1.pipe similarity index 96% rename from packages/tinybird/pipes/aggregate__tcp_14d__v1.pipe rename to packages/tinybird/materializations/aggregate__tcp_14d__v1.pipe index 0e6eea1a..49fc644f 100644 --- a/packages/tinybird/pipes/aggregate__tcp_14d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_14d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "tcp" - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__tcp_1d.pipe b/packages/tinybird/materializations/aggregate__tcp_1d__v0.pipe similarity index 94% rename from packages/tinybird/pipes/aggregate__tcp_1d.pipe rename to packages/tinybird/materializations/aggregate__tcp_1d__v0.pipe index 4d1356a5..a3c5cb0f 100644 --- a/packages/tinybird/pipes/aggregate__tcp_1d.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_1d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS tcp - NODE aggregate SQL > @@ -19,3 +15,5 @@ SQL > TYPE materialized DATASOURCE mv__tcp_1d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_1d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_1d__v1.pipe similarity index 96% rename from packages/tinybird/pipes/aggregate__tcp_1d__v1.pipe rename to packages/tinybird/materializations/aggregate__tcp_1d__v1.pipe index 8440427c..7dfdb4a5 100644 --- a/packages/tinybird/pipes/aggregate__tcp_1d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_1d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "tcp" - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__tcp_30d.pipe b/packages/tinybird/materializations/aggregate__tcp_30d__v0.pipe similarity index 94% rename from packages/tinybird/pipes/aggregate__tcp_30d.pipe rename to packages/tinybird/materializations/aggregate__tcp_30d__v0.pipe index deb04b5e..97f73562 100644 --- a/packages/tinybird/pipes/aggregate__tcp_30d.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_30d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS tcp - NODE aggregate SQL > @@ -19,3 +15,5 @@ SQL > TYPE materialized DATASOURCE mv__tcp_30d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_30d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_30d__v1.pipe similarity index 96% rename from packages/tinybird/pipes/aggregate__tcp_30d__v1.pipe rename to packages/tinybird/materializations/aggregate__tcp_30d__v1.pipe index 563f961a..f36c7e0e 100644 --- a/packages/tinybird/pipes/aggregate__tcp_30d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_30d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "tcp" - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__tcp_7d.pipe b/packages/tinybird/materializations/aggregate__tcp_7d__v0.pipe similarity index 94% rename from packages/tinybird/pipes/aggregate__tcp_7d.pipe rename to packages/tinybird/materializations/aggregate__tcp_7d__v0.pipe index 5270ab1c..687584df 100644 --- a/packages/tinybird/pipes/aggregate__tcp_7d.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_7d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS tcp - NODE aggregate SQL > @@ -19,3 +15,5 @@ SQL > TYPE materialized DATASOURCE mv__tcp_7d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_7d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_7d__v1.pipe similarity index 96% rename from packages/tinybird/pipes/aggregate__tcp_7d__v1.pipe rename to packages/tinybird/materializations/aggregate__tcp_7d__v1.pipe index f762815c..c7c62d4b 100644 --- a/packages/tinybird/pipes/aggregate__tcp_7d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_7d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "tcp" - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__tcp_90d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_90d__v1.pipe similarity index 96% rename from packages/tinybird/pipes/aggregate__tcp_90d__v1.pipe rename to packages/tinybird/materializations/aggregate__tcp_90d__v1.pipe index 4a0a126e..f4db908c 100644 --- a/packages/tinybird/pipes/aggregate__tcp_90d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_90d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "tcp" - NODE aggregate SQL > @@ -18,3 +16,5 @@ SQL > TYPE materialized DATASOURCE mv__tcp_90d__v1 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_full_14d__v0.pipe b/packages/tinybird/materializations/aggregate__tcp_full_14d__v0.pipe similarity index 57% rename from packages/tinybird/pipes/aggregate__tcp_full_14d__v0.pipe rename to packages/tinybird/materializations/aggregate__tcp_full_14d__v0.pipe index ca9c70f5..7331d328 100644 --- a/packages/tinybird/pipes/aggregate__tcp_full_14d__v0.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_full_14d__v0.pipe @@ -2,14 +2,24 @@ DESCRIPTION > Stores all the data from the http_response table for the last 30 days, mainly used for accessing the data details. -TAGS "tcp, full" - NODE aggregate SQL > SELECT toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, - * + monitorId, + region, + timestamp, + cronTimestamp, + timing, + workspaceId, + latency, + errorMessage, + error, + trigger, + uri, + id, + requestStatus FROM tcp_response__v0 TYPE materialized diff --git a/packages/tinybird/materializations/aggregate__tcp_full_30d__v0.pipe b/packages/tinybird/materializations/aggregate__tcp_full_30d__v0.pipe new file mode 100644 index 00000000..535e4f07 --- /dev/null +++ b/packages/tinybird/materializations/aggregate__tcp_full_30d__v0.pipe @@ -0,0 +1,28 @@ +DESCRIPTION > + Stores all the data from the http_response table for the last 30 days, mainly used for accessing the data details. + + +NODE aggregate +SQL > + + SELECT + toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, + monitorId, + region, + timestamp, + cronTimestamp, + timing, + workspaceId, + latency, + errorMessage, + error, + trigger, + uri, + id, + requestStatus + FROM tcp_response__v0 + +TYPE materialized +DATASOURCE mv__tcp_full_30d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_status_45d.pipe b/packages/tinybird/materializations/aggregate__tcp_status_45d__v0.pipe similarity index 91% rename from packages/tinybird/pipes/aggregate__tcp_status_45d.pipe rename to packages/tinybird/materializations/aggregate__tcp_status_45d__v0.pipe index c3389940..e7d27a7d 100644 --- a/packages/tinybird/pipes/aggregate__tcp_status_45d.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_status_45d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS tcp, statuspage - NODE aggregate SQL > @@ -17,3 +13,5 @@ SQL > TYPE materialized DATASOURCE mv__tcp_status_45d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_status_45d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_status_45d__v1.pipe similarity index 95% rename from packages/tinybird/pipes/aggregate__tcp_status_45d__v1.pipe rename to packages/tinybird/materializations/aggregate__tcp_status_45d__v1.pipe index 2b2107c8..2a636484 100644 --- a/packages/tinybird/pipes/aggregate__tcp_status_45d__v1.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_status_45d__v1.pipe @@ -1,5 +1,3 @@ -TAGS "tcp, statuspage" - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/aggregate__tcp_status_7d.pipe b/packages/tinybird/materializations/aggregate__tcp_status_7d__v0.pipe similarity index 91% rename from packages/tinybird/pipes/aggregate__tcp_status_7d.pipe rename to packages/tinybird/materializations/aggregate__tcp_status_7d__v0.pipe index 77712626..6f71bf85 100644 --- a/packages/tinybird/pipes/aggregate__tcp_status_7d.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_status_7d__v0.pipe @@ -1,7 +1,3 @@ -VERSION 0 - -TAGS tcp, statuspage - NODE aggregate SQL > @@ -17,3 +13,5 @@ SQL > TYPE materialized DATASOURCE mv__tcp_status_7d__v0 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_uptime_30d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_uptime_30d__v1.pipe similarity index 100% rename from packages/tinybird/pipes/aggregate__tcp_uptime_30d__v1.pipe rename to packages/tinybird/materializations/aggregate__tcp_uptime_30d__v1.pipe diff --git a/packages/tinybird/pipes/aggregate__tcp_uptime_7d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_uptime_7d__v1.pipe similarity index 100% rename from packages/tinybird/pipes/aggregate__tcp_uptime_7d__v1.pipe rename to packages/tinybird/materializations/aggregate__tcp_uptime_7d__v1.pipe diff --git a/packages/tinybird/materializations/aggregate__tcp_uptime_90d__v1.pipe b/packages/tinybird/materializations/aggregate__tcp_uptime_90d__v1.pipe new file mode 100644 index 00000000..179056e6 --- /dev/null +++ b/packages/tinybird/materializations/aggregate__tcp_uptime_90d__v1.pipe @@ -0,0 +1,15 @@ +NODE aggregate +SQL > + + SELECT + toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, + region, + requestStatus, + monitorId, + workspaceId + FROM tcp_response__v0 + +TYPE materialized +DATASOURCE mv__tcp_uptime_90d__v1 + + diff --git a/packages/tinybird/pipes/aggregate__tcp_workspace_30d__v0.pipe b/packages/tinybird/materializations/aggregate__tcp_workspace_30d__v0.pipe similarity index 96% rename from packages/tinybird/pipes/aggregate__tcp_workspace_30d__v0.pipe rename to packages/tinybird/materializations/aggregate__tcp_workspace_30d__v0.pipe index 8430c9e3..258f0b6d 100644 --- a/packages/tinybird/pipes/aggregate__tcp_workspace_30d__v0.pipe +++ b/packages/tinybird/materializations/aggregate__tcp_workspace_30d__v0.pipe @@ -1,5 +1,3 @@ -TAGS "tcp" - NODE aggregate SQL > diff --git a/packages/tinybird/pipes/__ttl_45d_count_utc_get.pipe b/packages/tinybird/pipes/__ttl_45d_count_utc_get.pipe deleted file mode 100644 index d91fd4a2..00000000 --- a/packages/tinybird/pipes/__ttl_45d_count_utc_get.pipe +++ /dev/null @@ -1,19 +0,0 @@ -VERSION 1 -TOKEN "__ttl_45d_count_utc_get__v1_endpoint_read_7956" READ - -NODE __ttl_45d_count_utc_get_0 -SQL > - - % - SELECT time as day, countMerge(count) as count, countMerge(ok) as ok - FROM mv__http_status_45d__v0 - WHERE - monitorId = {{ String(monitorId, '4') }} - GROUP BY day - ORDER BY day DESC - WITH FILL - FROM - toStartOfDay(toStartOfDay(toTimeZone(now(), 'UTC'))) - TO toStartOfDay( - date_sub(DAY, 45, now()) - ) STEP INTERVAL -1 DAY diff --git a/packages/tinybird/pipes/aggregate__external_status_daily__v0.pipe b/packages/tinybird/pipes/aggregate__external_status_daily__v0.pipe deleted file mode 100644 index e716dde4..00000000 --- a/packages/tinybird/pipes/aggregate__external_status_daily__v0.pipe +++ /dev/null @@ -1,28 +0,0 @@ -TAGS "external_status" - -NODE aggregate -SQL > - - SELECT - toDate(toTimeZone(fromUnixTimestamp64Milli(fetched_at), 'UTC')) AS day, - id, - argMaxState( - indicator, - toUInt8( - multiIf( - indicator = 'critical', 3, - indicator = 'major', 2, - indicator = 'minor', 1, - 0 - ) - ) - ) AS worst_indicator, - maxState(toUInt8(status = 'under_maintenance')) AS had_maintenance, - sumState(toUInt32(1)) AS snapshot_count - FROM external_status__v1 - GROUP BY - day, - id - -TYPE materialized -DATASOURCE mv__external_status_daily__v0 diff --git a/packages/tinybird/pipes/aggregate__http_timing_phases_90d__v1.pipe b/packages/tinybird/pipes/aggregate__http_timing_phases_90d__v1.pipe deleted file mode 100644 index f2d58c3c..00000000 --- a/packages/tinybird/pipes/aggregate__http_timing_phases_90d__v1.pipe +++ /dev/null @@ -1,33 +0,0 @@ -NODE aggregate -SQL > - - SELECT - toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, - latency, - region, - trigger, - statusCode, - monitorId, - workspaceId, - requestStatus, - - -- Compute actual durations from timing phases - if(isNull(JSONExtractInt(timing, 'dnsStart')) OR isNull(JSONExtractInt(timing, 'dnsDone')), NULL, - JSONExtractInt(timing, 'dnsDone') - JSONExtractInt(timing, 'dnsStart')) AS dns, - - if(isNull(JSONExtractInt(timing, 'connectStart')) OR isNull(JSONExtractInt(timing, 'connectDone')), NULL, - JSONExtractInt(timing, 'connectDone') - JSONExtractInt(timing, 'connectStart')) AS connect, - - if(isNull(JSONExtractInt(timing, 'tlsHandshakeStart')) OR isNull(JSONExtractInt(timing, 'tlsHandshakeDone')), NULL, - JSONExtractInt(timing, 'tlsHandshakeDone') - JSONExtractInt(timing, 'tlsHandshakeStart')) AS tls, - - if(isNull(JSONExtractInt(timing, 'firstByteStart')) OR isNull(JSONExtractInt(timing, 'firstByteDone')), NULL, - JSONExtractInt(timing, 'firstByteDone') - JSONExtractInt(timing, 'firstByteStart')) AS firstByte, - - if(isNull(JSONExtractInt(timing, 'transferStart')) OR isNull(JSONExtractInt(timing, 'transferDone')), NULL, - JSONExtractInt(timing, 'transferDone') - JSONExtractInt(timing, 'transferStart')) AS transfer - - FROM ping_response__v8 - -TYPE materialized -DATASOURCE mv__http_timing_phases_90d__v1 diff --git a/packages/tinybird/pipes/aggregate__http_uptime_90d__v1.pipe b/packages/tinybird/pipes/aggregate__http_uptime_90d__v1.pipe deleted file mode 100644 index 10e064a6..00000000 --- a/packages/tinybird/pipes/aggregate__http_uptime_90d__v1.pipe +++ /dev/null @@ -1,17 +0,0 @@ -VERSION 1 - -TAGS http - -NODE aggregate -SQL > - - SELECT - toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, - region, - requestStatus, - monitorId, - workspaceId - FROM ping_response__v8 - -TYPE materialized -DATASOURCE mv__http_uptime_90d__v1 diff --git a/packages/tinybird/pipes/aggregate__tcp_full_30d__v0.pipe b/packages/tinybird/pipes/aggregate__tcp_full_30d__v0.pipe deleted file mode 100644 index e1fdc260..00000000 --- a/packages/tinybird/pipes/aggregate__tcp_full_30d__v0.pipe +++ /dev/null @@ -1,16 +0,0 @@ -DESCRIPTION > - Stores all the data from the http_response table for the last 30 days, mainly used for accessing the data details. - - -TAGS "tcp, full" - -NODE aggregate -SQL > - - SELECT - toDateTime(fromUnixTimestamp64Milli(tcp_response__v0.cronTimestamp)) AS time, - * - FROM tcp_response__v0 - -TYPE materialized -DATASOURCE mv__tcp_full_30d__v0 diff --git a/packages/tinybird/pipes/aggregate__tcp_uptime_90d__v1.pipe b/packages/tinybird/pipes/aggregate__tcp_uptime_90d__v1.pipe deleted file mode 100644 index 71676f32..00000000 --- a/packages/tinybird/pipes/aggregate__tcp_uptime_90d__v1.pipe +++ /dev/null @@ -1,13 +0,0 @@ -NODE aggregate -SQL > - - SELECT - toDateTime(fromUnixTimestamp64Milli(cronTimestamp)) AS time, - region, - requestStatus, - monitorId, - workspaceId - FROM tcp_response__v0 - -TYPE materialized -DATASOURCE mv__tcp_uptime_90d__v1 diff --git a/packages/tinybird/pipes/get_result_for_on_demand_check_http.pipe b/packages/tinybird/pipes/get_result_for_on_demand_check_http.pipe deleted file mode 100644 index 4053b4cf..00000000 --- a/packages/tinybird/pipes/get_result_for_on_demand_check_http.pipe +++ /dev/null @@ -1,23 +0,0 @@ -VERSION 0 - -NODE endpoint -SQL > - - % - SELECT - latency, - monitorId, - error, - region, - statusCode, - timestamp, - url, - workspaceId, - timing, - cronTimestamp - FROM mv__http_full_30d__v0 - where - cronTimestamp = {{ String(timestamp, '1729871694536') }} and - monitorId = {{ String(monitorId, '2260') }} - and url = {{ String(url , 'https://www.openstatus.dev/api/ping/edge') }} - order by cronTimestamp desc diff --git a/packages/tinybird/pipes/public_status.pipe b/packages/tinybird/pipes/public_status.pipe deleted file mode 100644 index 88f9c7cb..00000000 --- a/packages/tinybird/pipes/public_status.pipe +++ /dev/null @@ -1,22 +0,0 @@ -VERSION 0 - -DESCRIPTION > - last 5 cron timestamps within last 3 hours - -NODE group_by_cronTimestamp -SQL > - - % - SELECT - cronTimestamp, - count() AS count, - count(multiIf((statusCode >= 200) AND (statusCode <= 299), 1, NULL)) AS ok - FROM ping_response__v8 - WHERE - monitorId = {{ String(monitorId, '1') }} - {% if defined(url) %} AND url = {{ String(url) }} {% end %} - AND cronTimestamp - >= toUnixTimestamp64Milli(toDateTime64(now() - INTERVAL 3 HOUR, 3)) - GROUP BY cronTimestamp, monitorId - ORDER BY cronTimestamp DESC - LIMIT {{ Int16(limit, 5)}} diff --git a/packages/tinybird/pipes/response_details.pipe b/packages/tinybird/pipes/response_details.pipe deleted file mode 100644 index 80d062cf..00000000 --- a/packages/tinybird/pipes/response_details.pipe +++ /dev/null @@ -1,13 +0,0 @@ -VERSION 0 - -NODE response_graph_0 -SQL > - - % - SELECT * - FROM ping_response__v8 - WHERE - monitorId = {{ String(monitorId, '1') }} - {% if defined(url) %} AND url = {{ String(url) }} {% end %} - AND cronTimestamp = {{ Int64(cronTimestamp, 1706467215188) }} - AND region = {{ String(region, 'ams') }} diff --git a/packages/tinybird/pipes/response_graph.pipe b/packages/tinybird/pipes/response_graph.pipe deleted file mode 100644 index 34f9c0ff..00000000 --- a/packages/tinybird/pipes/response_graph.pipe +++ /dev/null @@ -1,26 +0,0 @@ -VERSION 0 - -NODE response_graph_0 -SQL > - - % - SELECT - region, - toStartOfInterval( - toDateTime(cronTimestamp / 1000), - INTERVAL {{ Int64(interval, 30) }} MINUTE - ) as h, - toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp, - round(avg(latency)) as avgLatency, - round(quantile(0.75)(latency)) as p75Latency, - round(quantile(0.9)(latency)) as p90Latency, - round(quantile(0.95)(latency)) as p95Latency, - round(quantile(0.99)(latency)) as p99Latency - FROM ping_response__v8 - WHERE - monitorId = {{ String(monitorId, '1') }} - {% if defined(url) %} AND url = {{ String(url) }} {% end %} - {% if defined(fromDate) %} AND timestamp >= {{ Int64(fromDate) }} {% end %} - {% if defined(toDate) %} AND timestamp <= {{ Int64(toDate) }} {% end %} - GROUP BY h, region - ORDER BY h DESC diff --git a/packages/tinybird/pipes/response_list.pipe b/packages/tinybird/pipes/response_list.pipe deleted file mode 100644 index e194e4ec..00000000 --- a/packages/tinybird/pipes/response_list.pipe +++ /dev/null @@ -1,24 +0,0 @@ -VERSION 2 - -NODE response_list_0 -SQL > - - % - SELECT latency, monitorId, region, statusCode, timestamp, url, workspaceId, cronTimestamp, message - FROM ping_response__v8 - WHERE monitorId = {{ String(monitorId, 'openstatusPing') }} - {% if defined(url) %} AND url = {{ String(url) }} {% end %} - {% if defined(region) %} - AND region = {{ String(region) }} - {% end %} - {% if defined(cronTimestamp) %} - AND cronTimestamp = {{ Int64(cronTimestamp) }} - {% end %} - {% if defined(fromDate) %} - AND cronTimestamp >= {{ Int64(fromDate) }} - {% end %} - {% if defined(toDate) %} - AND cronTimestamp <= {{ Int64(toDate) }} - {% end %} - ORDER BY timestamp DESC - LIMIT {{Int32(limit, 100)}} diff --git a/packages/tinybird/pipes/single_checks_get.pipe b/packages/tinybird/pipes/single_checks_get.pipe deleted file mode 100644 index 913e2688..00000000 --- a/packages/tinybird/pipes/single_checks_get.pipe +++ /dev/null @@ -1,16 +0,0 @@ -VERSION 1 - -NODE endpoint -SQL > - - % - SELECT * - from check_response_http - WHERE - workspaceId = {{ Int16(workspaceId, 1) }} - {% if defined(requestId) %} AND requestId = {{ Int16(requestId) }} {% end %} - ORDER BY timestamp DESC - LIMIT {{ Int32(pageSize, 10) }} - OFFSET {{ Int32(page, 0) * Int32(pageSize, 10) }} - -