Skip to content

Commit 3a58e44

Browse files
committed
add successful_http_head. CheckerNetwork/spark-checker#104
1 parent fbb8ef7 commit 3a58e44

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/components/histogram.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ export function Histogram(events, { width, title, thresholds }) {
1212
if (d.success_rate_http != null) {
1313
res.push({ type: 'HTTP only', value: d.success_rate_http * 100 })
1414
}
15+
if (d.success_rate_http_head != null) {
16+
res.push({ type: 'HTTP only with HEAD support', value: d.success_rate_http_head * 100 })
17+
}
1518
return res
1619
})
1720

src/components/line-graph.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ export function LineGraph(events, { width, height, title, start, end } = {}) {
1818
success_rate_http: event.success_rate_http,
1919
type: 'HTTP only',
2020
})),
21+
...filteredEvents.map((event) => ({
22+
day: event.day,
23+
success_rate_http: event.success_rate_http,
24+
type: 'HTTP only with HEAD support',
25+
})),
2126
]
2227

2328
return Plot.plot({
@@ -40,6 +45,12 @@ export function LineGraph(events, { width, height, title, start, end } = {}) {
4045
stroke: 'type',
4146
curve: 'linear',
4247
}),
48+
Plot.lineY(combinedData, {
49+
x: 'day',
50+
y: 'success_rate_http_head',
51+
stroke: 'type',
52+
curve: 'linear',
53+
}),
4354
],
4455
})
4556
}

src/index.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const tidySparkMinerRates = SparkMinerRates.sort(
4747
ttfb_ms,
4848
success_rate: `${(record.success_rate * 100).toFixed(2)}%`,
4949
success_rate_http: `${(record.success_rate_http * 100).toFixed(2)}%`,
50+
success_rate_http_head: `${(record.success_rate_http_head * 100).toFixed(2)}%`,
5051
}
5152
})
5253
```
@@ -90,7 +91,7 @@ const end = view(Inputs.date({ label: 'End', value: getDateXDaysAgo(1) }))
9091
resize((width) => Histogram(SparkMinerRates, { width, title: "Retrieval Success Rate Buckets", thresholds: 10 }))
9192
}</div>
9293
<div class="card">${
93-
resize((width) => Histogram(nonZeroSparkMinerRates.map((record) => ({success_rate: record.success_rate, success_rate_http: record.success_rate_http? record.success_rate_http: null})), { width, title: "Non-zero Miners: Retrieval Success Rate Buckets", thresholds: 10 }))
94+
resize((width) => Histogram(nonZeroSparkMinerRates.map((record) => ({success_rate: record.success_rate, success_rate_http: record.success_rate_http? record.success_rate_http: null, success_rate_http_head: record.success_rate_http_head? record.success_rate_http_head: null})), { width, title: "Non-zero Miners: Retrieval Success Rate Buckets", thresholds: 10 }))
9495
}</div>
9596
</div>
9697
@@ -121,6 +122,16 @@ const nonZeroMinersOverTime = Object.entries(SparkMinerRsrSummaries).flatMap(
121122
: null,
122123
type: 'HTTP only',
123124
},
125+
{
126+
day: new Date(day),
127+
count_succes_rate_http_head: miners.some((m) => m.success_rate_http_head != null)
128+
? countAbove(
129+
miners.map((m) => m.success_rate_http_head),
130+
0,
131+
)
132+
: null,
133+
type: 'HTTP only with HEAD support',
134+
},
124135
],
125136
)
126137
const percentiles = Object.entries(SparkMinerRsrSummaries).flatMap(

0 commit comments

Comments
 (0)