diff --git a/apps/web/src/components/marketing/stats.tsx b/apps/web/src/components/marketing/stats.tsx
index 17771173..eddca4bf 100644
--- a/apps/web/src/components/marketing/stats.tsx
+++ b/apps/web/src/components/marketing/stats.tsx
@@ -6,8 +6,8 @@ import { OSTinybird } from "@openstatus/tinybird";
const tb = new OSTinybird(env.TINY_BIRD_API_KEY);
export async function Stats() {
- const tbTotalStats = await tb.homeStats({});
const tbLastHourStats = await tb.homeStats({ period: "1h" });
+ const tbWeeklyStats = await tb.homeStats({ period: "1w" });
// const totalActiveMonitors = await api.monitor.getTotalActiveMonitors.query();
return (
@@ -15,9 +15,9 @@ export async function Stats() {
- {numberFormatter(tbTotalStats?.data?.[0]?.count || 0)}
+ {numberFormatter(tbWeeklyStats?.data?.[0]?.count || 0)}
-
Total pings
+
Weekly pings
diff --git a/packages/tinybird/pipes/endpoint__stats_global.pipe b/packages/tinybird/pipes/endpoint__stats_global.pipe
index 37a270a8..ed4b7c23 100644
--- a/packages/tinybird/pipes/endpoint__stats_global.pipe
+++ b/packages/tinybird/pipes/endpoint__stats_global.pipe
@@ -7,10 +7,16 @@ SQL >
SELECT COUNT(*) as count
FROM ping_response__v8
{% if defined(period) %}
- {% if String(period) == "1h" %}
- WHERE cronTimestamp > toUnixTimestamp(now() - INTERVAL 1 HOUR) * 1000
+ {% 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 %}
diff --git a/packages/tinybird/pipes/home_stats.pipe b/packages/tinybird/pipes/home_stats.pipe
deleted file mode 100644
index bdf88530..00000000
--- a/packages/tinybird/pipes/home_stats.pipe
+++ /dev/null
@@ -1,18 +0,0 @@
-VERSION 0
-
-NODE home_stats_0
-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
- {% else %}
- WHERE cronTimestamp > 0
- {% end %}
- {% end %}
-
diff --git a/packages/tinybird/src/client.ts b/packages/tinybird/src/client.ts
index 6ce30f9d..24add3d9 100644
--- a/packages/tinybird/src/client.ts
+++ b/packages/tinybird/src/client.ts
@@ -19,7 +19,7 @@ export class OSTinybird {
pipe: "endpoint__stats_global__v0",
parameters: z.object({
cronTimestamp: z.number().int().optional(),
- period: z.enum(["total", "1h", "10m"]).optional(),
+ period: z.enum(["total", "1h", "10m", "1d", "1w", "1m"]).optional(),
}),
data: z.object({
count: z.number().int(),