Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add successful_http_head. CheckerNetwork/spark#104 #322

Merged
merged 4 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"standard": "^17.1.2"
},
"dependencies": {
"@filecoin-station/spark-evaluate": "^1.0.4",
"@filecoin-station/spark-evaluate": "^1.2.0",
"pg": "^8.13.3",
"postgrator": "^8.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion observer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "mocha"
},
"devDependencies": {
"@filecoin-station/spark-evaluate": "^1.0.4",
"@filecoin-station/spark-evaluate": "^1.2.0",
"mocha": "^11.1.0",
"standard": "^17.1.2"
},
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions stats/lib/stats-fetchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const fetchRetrievalSuccessRate = async (pgPools, filter) => {
day::text,
SUM(total) as total,
SUM(successful) as successful,
SUM(successful_http) as successful_http
SUM(successful_http) as successful_http,
SUM(successful_http_head) as successful_http_head
FROM retrieval_stats
WHERE day >= $1 AND day <= $2 ${filter.nonZero === 'true' ? 'AND successful > 0' : ''}
GROUP BY day
Expand All @@ -27,7 +28,9 @@ export const fetchRetrievalSuccessRate = async (pgPools, filter) => {
success_rate: r.total > 0 ? r.successful / r.total : null,
successful_http: r.successful_http ?? null,
// successful_http might be null because the column was added later
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null,
// successful_http_head might be null because the column was added later
success_rate_http_head: r.total > 0 && r.successful_http_head !== null ? r.successful_http_head / r.total : null
}))
return stats
}
Expand Down Expand Up @@ -218,7 +221,8 @@ export const fetchMinersRSRSummary = async (pgPools, filter) => {
miner_id,
SUM(total) as total,
SUM(successful) as successful,
SUM(successful_http) as successful_http
SUM(successful_http) as successful_http,
SUM(successful_http_head) as successful_http_head
FROM retrieval_stats
WHERE day >= $1 AND day <= $2
GROUP BY miner_id
Expand All @@ -233,7 +237,9 @@ export const fetchMinersRSRSummary = async (pgPools, filter) => {
success_rate: r.total > 0 ? r.successful / r.total : null,
successful_http: r.successful_http ?? null,
// successful_http might be null because the column was added later
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null,
// successful_http_head might be null because the column was added later
success_rate_http_head: r.total > 0 && r.successful_http_head !== null ? r.successful_http_head / r.total : null
}))
return stats
}
Expand All @@ -249,7 +255,8 @@ export const fetchDailyMinerRSRSummary = async (pgPools, { from, to }, minerId)
SELECT
day::TEXT,
SUM(total) as total, SUM(successful) as successful,
SUM(successful_http) as successful_http
SUM(successful_http) as successful_http,
SUM(successful_http_head) as successful_http_head
FROM retrieval_stats
WHERE miner_id = $1 AND day >= $2 AND day <= $3
GROUP BY day
Expand All @@ -266,7 +273,9 @@ export const fetchDailyMinerRSRSummary = async (pgPools, { from, to }, minerId)
success_rate: r.total > 0 ? r.successful / r.total : null,
successful_http: r.successful_http ?? null,
// successful_http might be null because the column was added later
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null
success_rate_http: r.total > 0 && r.successful_http !== null ? r.successful_http / r.total : null,
// successful_http_head might be null because the column was added later
success_rate_http_head: r.total > 0 && r.successful_http_head !== null ? r.successful_http_head / r.total : null
}))
return stats
}
Expand Down
2 changes: 1 addition & 1 deletion stats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "mocha"
},
"devDependencies": {
"@filecoin-station/spark-evaluate": "^1.1.0",
"@filecoin-station/spark-evaluate": "^1.2.0",
"mocha": "^11.1.0",
"standard": "^17.1.2"
},
Expand Down
Loading