Skip to content

Commit 288cfb8

Browse files
committed
Add successful_http_head. CheckerNetwork/spark-checker#104
1 parent 3c2c5b3 commit 288cfb8

File tree

2 files changed

+63
-53
lines changed

2 files changed

+63
-53
lines changed

stats/lib/stats-fetchers.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export const fetchRetrievalSuccessRate = async (pgPools, filter) => {
1111
day::text,
1212
SUM(total) as total,
1313
SUM(successful) as successful,
14-
SUM(successful_http) as successful_http
14+
SUM(successful_http) as successful_http,
15+
SUM(successful_http_head) as successful_http_head
1516
FROM retrieval_stats
1617
WHERE day >= $1 AND day <= $2 ${filter.nonZero === 'true' ? 'AND successful > 0' : ''}
1718
GROUP BY day
@@ -27,7 +28,9 @@ export const fetchRetrievalSuccessRate = async (pgPools, filter) => {
2728
success_rate: r.total > 0 ? r.successful / r.total : null,
2829
successful_http: r.successful_http ?? null,
2930
// successful_http might be null because the column was added later
30-
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null
31+
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null,
32+
// successful_http_head might be null because the column was added later
33+
success_rate_http_head: r.total > 0 && r.successful_http_head !== null ? r.successful_http_head / r.total : null
3134
}))
3235
return stats
3336
}
@@ -218,7 +221,8 @@ export const fetchMinersRSRSummary = async (pgPools, filter) => {
218221
miner_id,
219222
SUM(total) as total,
220223
SUM(successful) as successful,
221-
SUM(successful_http) as successful_http
224+
SUM(successful_http) as successful_http,
225+
SUM(successful_http_head) as successful_http_head
222226
FROM retrieval_stats
223227
WHERE day >= $1 AND day <= $2
224228
GROUP BY miner_id
@@ -233,7 +237,9 @@ export const fetchMinersRSRSummary = async (pgPools, filter) => {
233237
success_rate: r.total > 0 ? r.successful / r.total : null,
234238
successful_http: r.successful_http ?? null,
235239
// successful_http might be null because the column was added later
236-
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null
240+
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null,
241+
// successful_http_head might be null because the column was added later
242+
success_rate_http_head: r.total > 0 && r.successful_http_head !== null ? r.successful_http_head / r.total : null
237243
}))
238244
return stats
239245
}
@@ -249,7 +255,8 @@ export const fetchDailyMinerRSRSummary = async (pgPools, { from, to }, minerId)
249255
SELECT
250256
day::TEXT,
251257
SUM(total) as total, SUM(successful) as successful,
252-
SUM(successful_http) as successful_http
258+
SUM(successful_http) as successful_http,
259+
SUM(successful_http_head) as successful_http_head
253260
FROM retrieval_stats
254261
WHERE miner_id = $1 AND day >= $2 AND day <= $3
255262
GROUP BY day
@@ -266,7 +273,9 @@ export const fetchDailyMinerRSRSummary = async (pgPools, { from, to }, minerId)
266273
success_rate: r.total > 0 ? r.successful / r.total : null,
267274
successful_http: r.successful_http ?? null,
268275
// successful_http might be null because the column was added later
269-
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null
276+
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null,
277+
// successful_http_head might be null because the column was added later
278+
success_rate_http_head: r.total > 0 && r.successful_http_head !== null ? r.successful_http_head / r.total : null
270279
}))
271280
return stats
272281
}

0 commit comments

Comments
 (0)