blockrate-server 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/stores/postgres.ts +10 -1
- package/src/stores/sqlite.ts +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blockrate-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Self-hostable ingestion server and dashboard for block-rate.",
|
|
5
5
|
"homepage": "https://blockrate.app",
|
|
6
6
|
"bugs": "https://github.com/afonsojramos/blockrate/issues",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"test": "bun test"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"drizzle-orm": "
|
|
35
|
+
"drizzle-orm": "catalog:",
|
|
36
36
|
"zod": "^3.23.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"drizzle-kit": "
|
|
39
|
+
"drizzle-kit": "catalog:"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/stores/postgres.ts
CHANGED
|
@@ -141,7 +141,16 @@ export class PostgresStore implements BlockRateStore {
|
|
|
141
141
|
blocked: sql<number>`SUM(CASE WHEN ${events.status} = 'blocked' THEN 1 ELSE 0 END)`.as(
|
|
142
142
|
"blocked",
|
|
143
143
|
),
|
|
144
|
-
|
|
144
|
+
// Average over loaded events only — blocked events' latency is
|
|
145
|
+
// dominated by the 3000ms probe timeout constant, which would
|
|
146
|
+
// pull the average toward a meaningless number for any
|
|
147
|
+
// blocked-heavy provider. Matches the hosted dashboard
|
|
148
|
+
// (apps/web/src/server/stats.ts) so self-hosted and hosted
|
|
149
|
+
// surface the same metric.
|
|
150
|
+
avgLatency:
|
|
151
|
+
sql<number>`AVG(CASE WHEN ${events.status} = 'loaded' THEN ${events.latency} END)`.as(
|
|
152
|
+
"avg_latency",
|
|
153
|
+
),
|
|
145
154
|
})
|
|
146
155
|
.from(events)
|
|
147
156
|
.where(where)
|
package/src/stores/sqlite.ts
CHANGED
|
@@ -109,7 +109,16 @@ export class SqliteStore implements BlockRateStore {
|
|
|
109
109
|
blocked: sql<number>`SUM(CASE WHEN ${events.status} = 'blocked' THEN 1 ELSE 0 END)`.as(
|
|
110
110
|
"blocked",
|
|
111
111
|
),
|
|
112
|
-
|
|
112
|
+
// Average over loaded events only — blocked events' latency is
|
|
113
|
+
// dominated by the 3000ms probe timeout constant, which would
|
|
114
|
+
// pull the average toward a meaningless number for any
|
|
115
|
+
// blocked-heavy provider. Matches the hosted dashboard
|
|
116
|
+
// (apps/web/src/server/stats.ts) so self-hosted and hosted
|
|
117
|
+
// surface the same metric.
|
|
118
|
+
avgLatency:
|
|
119
|
+
sql<number>`AVG(CASE WHEN ${events.status} = 'loaded' THEN ${events.latency} END)`.as(
|
|
120
|
+
"avg_latency",
|
|
121
|
+
),
|
|
113
122
|
})
|
|
114
123
|
.from(events)
|
|
115
124
|
.where(where)
|