Skip to content

Commit 1df3371

Browse files
authored
Add HTTP HEAD results. CheckerNetwork/spark-checker#104 (#29)
* add `successful_http_head`. CheckerNetwork/spark-checker#104 * rename metric * fix line * fmt * add tip
1 parent 84fd963 commit 1df3371

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

src/components/histogram.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ 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({
17+
type: 'HTTP only w/ HEAD',
18+
value: d.success_rate_http_head * 100,
19+
})
20+
}
1521
return res
1622
})
1723

src/components/line-graph.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ export function LineGraph(
2121
success_rate_http: event.success_rate_http,
2222
type: 'HTTP only',
2323
})),
24+
...filteredEvents.map((event) => ({
25+
day: event.day,
26+
success_rate_http_head: event.success_rate_http_head,
27+
type: 'HTTP only w/ HEAD',
28+
})),
2429
]
2530

2631
// Format functions for tooltip values
@@ -72,6 +77,19 @@ export function LineGraph(
7277
},
7378
},
7479
}),
80+
Plot.lineY(combinedData, {
81+
x: 'day',
82+
y: 'success_rate_http_head',
83+
stroke: 'type',
84+
curve: 'linear',
85+
tip: {
86+
format: {
87+
x: formatDate,
88+
y: formatPercent,
89+
type: true,
90+
},
91+
},
92+
}),
7593
],
7694
})
7795
}

src/index.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const tidySparkMinerRates = SparkMinerRates.sort(
5050
ttfb_ms,
5151
success_rate: `${(record.success_rate * 100).toFixed(2)}%`,
5252
success_rate_http: `${(record.success_rate_http * 100).toFixed(2)}%`,
53+
success_rate_http_head: `${(record.success_rate_http_head * 100).toFixed(2)}%`,
5354
}
5455
})
5556
const tidySparkClientRates = SparkClientRates.sort(
@@ -104,7 +105,7 @@ const end = view(Inputs.date({ label: 'End', value: getDateXDaysAgo(1) }))
104105
resize((width) => Histogram(SparkMinerRates, { width, title: "Retrieval Success Rate Buckets", thresholds: 10 }))
105106
}</div>
106107
<div class="card">${
107-
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 }))
108+
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 }))
108109
}</div>
109110
</div>
110111
@@ -135,6 +136,18 @@ const nonZeroMinersOverTime = Object.entries(SparkMinerRsrSummaries).flatMap(
135136
: null,
136137
type: 'HTTP only',
137138
},
139+
{
140+
day: new Date(day),
141+
count_succes_rate_http_head: miners.some(
142+
(m) => m.success_rate_http_head != null,
143+
)
144+
? countAbove(
145+
miners.map((m) => m.success_rate_http_head),
146+
0,
147+
)
148+
: null,
149+
type: 'HTTP only w/ HEAD',
150+
},
138151
],
139152
)
140153
const percentiles = Object.entries(SparkMinerRsrSummaries).flatMap(

0 commit comments

Comments
 (0)