Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
🔥 tb pipe (#1039)
Thibault Le Ouay5b798e152a35
diff --git a/apps/web/src/components/content/callout.tsx b/apps/web/src/components/content/callout.tsxindex 558fcea83..3066d7048 100644--- a/apps/web/src/components/content/callout.tsx+++ b/apps/web/src/components/content/callout.tsx@@ -45,7 +45,7 @@ export function Callout({const Icon = Icons[getIconName(variant)];return (<div className={cn(calloutVariants({ variant, className }))} {...props}>- <Icon className="h-4 w-4 mr-2 my-1.5 shrink-0" />+ <Icon className="my-1.5 mr-2 h-4 w-4 shrink-0" /><p>{children}</p></div>);diff --git a/apps/web/src/components/forms/monitor/section-scheduling.tsx b/apps/web/src/components/forms/monitor/section-scheduling.tsxindex 3e713b1e0..425e916e4 100644--- a/apps/web/src/components/forms/monitor/section-scheduling.tsx+++ b/apps/web/src/components/forms/monitor/section-scheduling.tsx@@ -92,7 +92,6 @@ export function SectionScheduling({ form, limits, plan }: Props) {<FormFieldcontrol={form.control}name="regions"- // biome-ignore lint/correctness/noUnusedVariables: <explanation>render={({ field }) => {return (<FormItem>diff --git a/apps/web/src/components/forms/shared/checkbox-label.tsx b/apps/web/src/components/forms/shared/checkbox-label.tsxindex bbec27364..fa7388a11 100644--- a/apps/web/src/components/forms/shared/checkbox-label.tsx+++ b/apps/web/src/components/forms/shared/checkbox-label.tsx@@ -36,7 +36,7 @@ export function CheckboxLabel({<LabelhtmlFor={`${name}-${id}`}className={cn(- "flex h-full items-center gap-1 rounded-md border border-border bg-popover p-4 pr-10 hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary [&:has([data-state=checked])]:border-primary peer-disabled:hover:bg-background peer-disabled:text-muted-foreground",+ "flex h-full items-center gap-1 rounded-md border border-border bg-popover p-4 pr-10 hover:bg-accent hover:text-accent-foreground peer-disabled:text-muted-foreground peer-disabled:hover:bg-background peer-data-[state=checked]:border-primary [&:has([data-state=checked])]:border-primary",className,)}>diff --git a/apps/web/src/components/layout/header/app-tabs.tsx b/apps/web/src/components/layout/header/app-tabs.tsxindex 03c0170ad..377d75108 100644--- a/apps/web/src/components/layout/header/app-tabs.tsx+++ b/apps/web/src/components/layout/header/app-tabs.tsx@@ -53,7 +53,7 @@ function IncidentsDot() {if (!open) return null;return (- <div className="absolute right-1 top-1">+ <div className="absolute top-1 right-1"><StatusDot status="error" active /></div>);diff --git a/packages/react/src/widget.tsx b/packages/react/src/widget.tsxindex 267a8bc37..2c10511da 100644--- a/packages/react/src/widget.tsx+++ b/packages/react/src/widget.tsx@@ -45,12 +45,10 @@ export async function StatusWidget({ slug, href }: StatusWidgetProps) {<span className="relative flex h-2 w-2">{status === "operational" ? (<span- // biome-ignore lint/nursery/useSortedClasses: color is a dynamic valueclassName={`absolute inline-flex h-full w-full animate-ping rounded-full ${color} opacity-75 duration-1000`}/>) : null}<span- // biome-ignore lint/nursery/useSortedClasses: color is a dynamic valueclassName={`relative inline-flex h-2 w-2 rounded-full ${color}`}/></span>diff --git a/packages/tinybird/datasources/__ttl_7d_count_mv.datasource b/packages/tinybird/datasources/__ttl_7d_count_mv.datasourcenew file mode 100644index 000000000..df51e9762--- /dev/null+++ b/packages/tinybird/datasources/__ttl_7d_count_mv.datasource@@ -0,0 +1,14 @@+VERSION 1+# Data Source created from Pipe '__ttl_7d_count__v1'++SCHEMA >+ `time` DateTime,+ `monitorId` String,+ `url` String,+ `count` AggregateFunction(count),+ `ok` AggregateFunction(count, Nullable(UInt8))++ENGINE "AggregatingMergeTree"+ENGINE_PARTITION_KEY "toYYYYMM(time)"+ENGINE_SORTING_KEY "time, monitorId, url"+ENGINE_TTL "time + toIntervalDay(7)"diff --git a/packages/tinybird/datasources/external_status.datasource b/packages/tinybird/datasources/external_status.datasourcenew file mode 100644index 000000000..37e485b8c--- /dev/null+++ b/packages/tinybird/datasources/external_status.datasource@@ -0,0 +1,12 @@++SCHEMA >+ `description` String `json:$.description`,+ `fetched_at` Int64 `json:$.fetched_at`,+ `indicator` String `json:$.indicator`,+ `name` String `json:$.name`,+ `time_zone` String `json:$.time_zone`,+ `updated_at` Int64 `json:$.updated_at`,+ `url` String `json:$.url`++ENGINE "MergeTree"+ENGINE_SORTING_KEY "description, time_zone, updated_at, url"diff --git a/packages/tinybird/datasources/tcp_response.datasource b/packages/tinybird/datasources/tcp_response.datasourcenew file mode 100644index 000000000..1a577c697--- /dev/null+++ b/packages/tinybird/datasources/tcp_response.datasource@@ -0,0 +1,15 @@+VERSION 0++SCHEMA >+ `monitorId` Int32 `json:$.monitorId`,+ `region` String `json:$.region`,+ `timestamp` Int64 `json:$.timestamp`,+ `timing` String `json:$.timing`,+ `workspaceId` Int32 `json:$.workspaceId`,+ `latency` Int64 `json:$.latency`,+ `errorMessage` Nullable(String) `json:$.errorMessage`,+ `error` Int16 `json:$.error`++ENGINE "MergeTree"+ENGINE_PARTITION_KEY "toYYYYMM(fromUnixTimestamp64Milli(timestamp))"+ENGINE_SORTING_KEY "monitorId, workspaceId"diff --git a/packages/tinybird/datasources/web_vitals.datasource b/packages/tinybird/datasources/web_vitals.datasourcenew file mode 100644index 000000000..403d40195--- /dev/null+++ b/packages/tinybird/datasources/web_vitals.datasource@@ -0,0 +1,25 @@+VERSION 0++SCHEMA >+ `browser` String `json:$.browser`,+ `city` String `json:$.city`,+ `continent` String `json:$.continent`,+ `country` String `json:$.country`,+ `device` String `json:$.device`,+ `dsn` String `json:$.dsn`,+ `href` String `json:$.href`,+ `id` String `json:$.id`,+ `name` String `json:$.name`,+ `os` String `json:$.os`,+ `path` String `json:$.path`,+ `rating` String `json:$.rating`,+ `region_code` String `json:$.region_code`,+ `screen` String `json:$.screen`,+ `session_id` String `json:$.session_id`,+ `speed` String `json:$.speed`,+ `timezone` String `json:$.timezone`,+ `value` Float32 `json:$.value`,+ `timestamp` Nullable(DateTime) `json:$.timestamp`++ENGINE "MergeTree"+ENGINE_SORTING_KEY "session_id, speed, timezone"diff --git a/packages/tinybird/pipes/__ttl_14d_chart_all_regions_get.pipe b/packages/tinybird/pipes/__ttl_14d_chart_all_regions_get.pipenew file mode 100644index 000000000..d67c1fb1d--- /dev/null+++ b/packages/tinybird/pipes/__ttl_14d_chart_all_regions_get.pipe@@ -0,0 +1,23 @@+VERSION 1+TOKEN "__ttl_14d_chart_all_regions_get__v1_endpoint_read_6659" READ++NODE __ttl_14d_chart_all_regions_get_0+SQL >++ %+ SELECT+ toStartOfInterval(+ toDateTime(cronTimestamp / 1000), INTERVAL 1 HOUR+ ) as h,+ toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp,+ round(quantile(0.5)(latency)) as p50Latency,+ 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 __ttl_14d_mv+ WHERE monitorId = {{ String(monitorId, '1') }}+ GROUP BY h+ ORDER BY h DESC++diff --git a/packages/tinybird/pipes/__ttl_45d_statuspage_get.pipe b/packages/tinybird/pipes/__ttl_45d_statuspage_get.pipenew file mode 100644index 000000000..079283d98--- /dev/null+++ b/packages/tinybird/pipes/__ttl_45d_statuspage_get.pipe@@ -0,0 +1,38 @@+VERSION 1+TOKEN "__ttl_45d_statuspage_get_endpoint_read_1959" READ++NODE __ttl_45d_statuspage_get_0+SQL >++ %+ SELECT+ toDateTime(cronTimestamp / 1000, 'UTC') AS day,+ -- only for debugging purposes+ toTimezone(day, {{ String(timezone, 'Europe/London') }}) as with_timezone,+ toStartOfDay(with_timezone) as start_of_day,+ statusCode+ -- latency+ FROM __ttl_45d_mv+ WHERE monitorId = {{ String(monitorId, '4') }}++++NODE __ttl_7d_statuspage_get_1+SQL >++ %+ SELECT+ start_of_day as day,+ count() AS count,+ count(multiIf((statusCode >= 200) AND (statusCode <= 299), 1, NULL)) AS ok+ FROM __ttl_45d_statuspage_get_0+ GROUP BY start_of_day+ ORDER BY start_of_day DESC+ WITH FILL+ FROM+ toStartOfDay(toTimezone(now(), {{ String(timezone, 'Europe/London') }}))+ TO toStartOfDay(+ toTimezone(date_sub(DAY, 46, now()), {{ String(timezone, 'Europe/London') }})+ ) STEP INTERVAL -1 DAY++diff --git a/packages/tinybird/pipes/__ttl_7d_chart_all_regions_get.pipe b/packages/tinybird/pipes/__ttl_7d_chart_all_regions_get.pipenew file mode 100644index 000000000..86ab46c49--- /dev/null+++ b/packages/tinybird/pipes/__ttl_7d_chart_all_regions_get.pipe@@ -0,0 +1,23 @@+VERSION 1+TOKEN "__ttl_7d_chart_all_regions_get__v1_endpoint_read_8648" READ++NODE __ttl_7d_chart_all_regions_get_0+SQL >++ %+ SELECT+ toStartOfInterval(+ toDateTime(cronTimestamp / 1000), INTERVAL 1 HOUR+ ) as h,+ toUnixTimestamp64Milli(toDateTime64(h, 3)) as timestamp,+ round(quantile(0.5)(latency)) as p50Latency,+ 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 __ttl_7d_mv+ WHERE monitorId = {{ String(monitorId, '1') }}+ GROUP BY h+ ORDER BY h DESC++diff --git a/packages/tinybird/pipes/__ttl_7d_count.pipe b/packages/tinybird/pipes/__ttl_7d_count.pipenew file mode 100644index 000000000..8c13b8259--- /dev/null+++ b/packages/tinybird/pipes/__ttl_7d_count.pipe@@ -0,0 +1,24 @@+VERSION 1+DESCRIPTION >+ TODO: descripe what it is for!+++NODE __ttl_7d_count_0+SQL >++ SELECT+ time,+ monitorId,+ url,+ countState() AS count,+ countState(if(error = 0, 1, NULL)) AS ok+ FROM __ttl_45d_mv+ GROUP BY+ time,+ monitorId,+ url++TYPE materialized+DATASOURCE __ttl_7d_count_mv++diff --git a/packages/tinybird/pipes/__ttl_7d_count_get.pipe b/packages/tinybird/pipes/__ttl_7d_count_get.pipenew file mode 100644index 000000000..2dbd4bc14--- /dev/null+++ b/packages/tinybird/pipes/__ttl_7d_count_get.pipe@@ -0,0 +1,22 @@+VERSION 1+TOKEN "__ttl_7d_count_get__v1_endpoint_read_7412" READ++NODE __ttl_7d_count_get_0+SQL >++ %+ SELECT time as day, countMerge(count) as count, countMerge(ok) as ok+ FROM __ttl_7d_count_mv_test+ WHERE+ monitorId = {{ String(monitorId, '4') }}+ {% if defined(url) %} AND url = {{ String(url) }} {% end %}+ GROUP BY day+ ORDER BY day DESC+ WITH FILL+ FROM+ toStartOfDay(now())+ TO toStartOfDay(+ date_sub(DAY, 7, now())+ ) STEP INTERVAL -1 DAY++diff --git a/packages/tinybird/pipes/__ttl_7d_statuspage_get.pipe b/packages/tinybird/pipes/__ttl_7d_statuspage_get.pipenew file mode 100644index 000000000..397c58d46--- /dev/null+++ b/packages/tinybird/pipes/__ttl_7d_statuspage_get.pipe@@ -0,0 +1,38 @@+VERSION 1+TOKEN "__ttl_7d_statuspage_get_endpoint_read_0234" READ++NODE __ttl_7d_statuspage_get_0+SQL >++ %+ SELECT+ toDateTime(cronTimestamp / 1000, 'UTC') AS day,+ -- only for debugging purposes+ toTimezone(day, {{ String(timezone, 'Europe/London') }}) as with_timezone,+ toStartOfDay(with_timezone) as start_of_day,+ statusCode+ -- latency+ FROM __ttl_7d_mv+ WHERE monitorId = {{ String(monitorId, '4') }}++++NODE __ttl_7d_statuspage_get_1+SQL >++ %+ SELECT+ start_of_day as day,+ count() AS count,+ count(multiIf((statusCode >= 200) AND (statusCode <= 299), 1, NULL)) AS ok+ FROM __ttl_7d_statuspage_get_0+ GROUP BY start_of_day+ ORDER BY start_of_day DESC+ WITH FILL+ FROM+ toStartOfDay(toTimezone(now(), {{ String(timezone, 'Europe/London') }}))+ TO toStartOfDay(+ toTimezone(date_sub(DAY, 46, now()), {{ String(timezone, 'Europe/London') }})+ ) STEP INTERVAL -1 DAY++diff --git a/packages/tinybird/pipes/dashboard_request.pipe b/packages/tinybird/pipes/dashboard_request.pipenew file mode 100644index 000000000..431968645--- /dev/null+++ b/packages/tinybird/pipes/dashboard_request.pipe@@ -0,0 +1,17 @@+VERSION 0+NODE dashboard_request_0+SQL >++ %+ SELECT * FROM monitor_request_count_7d_mv+ WHERE monitorId = {{ String(monitorId, '1') }}+ {% if defined(url) %} AND url = {{ String(url) }} {% end %}++++NODE dashboard_request_1+SQL >++ SELECT * FROM dashboard_request_0++diff --git a/packages/tinybird/pipes/external_status.pipe b/packages/tinybird/pipes/external_status.pipenew file mode 100644index 000000000..465029dc7--- /dev/null+++ b/packages/tinybird/pipes/external_status.pipe@@ -0,0 +1,12 @@+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) }}++