Skip to content
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
7 changes: 7 additions & 0 deletions src/components/histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export function Histogram(events, { width, title, thresholds }) {
y: 'count',
x: 'type',
fill: 'type',
tip: {
format: {
threshold: (v) => `Range: ${v}%`,
count: (v) => `Count: ${v} miners`,
type: true,
},
},
}),
],
y: { grid: true },
Expand Down
23 changes: 23 additions & 0 deletions src/components/line-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ export function LineGraph(events, { width, height, title, start, end } = {}) {
})),
]

// Format functions for tooltip values
const formatDate = (d) =>
new Date(d).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric',
})
const formatPercent = (v) => (v ? `${v.toFixed(2)}%` : 'N/A')

return Plot.plot({
title,
width,
Expand All @@ -33,12 +42,26 @@ export function LineGraph(events, { width, height, title, start, end } = {}) {
y: 'success_rate',
stroke: 'type',
curve: 'linear',
tip: {
format: {
x: formatDate,
y: formatPercent,
type: true,
},
},
}),
Plot.lineY(combinedData, {
x: 'day',
y: 'success_rate_http',
stroke: 'type',
curve: 'linear',
tip: {
format: {
x: formatDate,
y: formatPercent,
type: true,
},
},
}),
],
})
Expand Down
70 changes: 62 additions & 8 deletions src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,43 @@ const percentiles = Object.entries(SparkMinerRsrSummaries).flatMap(
${Plot.plot({
title: '# of Filecoin SPs with a non-zero Spark Retrieval Success Rate',
x: { label: null },
y: { grid: true, label: null },
y: { grid: true, label: '# Non-Zero SPs' },
color: { legend: true },
marks: [
Plot.ruleY([0]),
Plot.line(nonZeroMinersOverTime, {
Plot.lineY(nonZeroMinersOverTime, {
x: 'day',
y: 'count_succes_rate',
stroke: "type",
curve: 'catmull-rom',
tip: {
format: {
x: d => new Date(d).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
}),
y: v => `${v} SPs`,
type: true
}
}
}),
Plot.line(nonZeroMinersOverTime, {
Plot.lineY(nonZeroMinersOverTime, {
x: 'day',
y: 'count_succes_rate_http',
stroke: "type",
curve: 'catmull-rom',
tip: {
format: {
x: d => new Date(d).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
}),
y: v => v ? `${v} SPs` : 'N/A',
type: true
}
}
})
]
})}
Expand All @@ -164,7 +186,7 @@ const percentiles = Object.entries(SparkMinerRsrSummaries).flatMap(
${Plot.plot({
title: '# of Filecoin SPs with Spark Retrieval Success Rate above x%',
x: { label: null },
y: { grid: true, label: null },
y: { grid: true, label: '# SPs above x%' },
color: {
scheme: "Paired",
legend: "swatches"
Expand All @@ -175,7 +197,18 @@ const percentiles = Object.entries(SparkMinerRsrSummaries).flatMap(
x: 'day',
y: 'count_succes_rate',
stroke: 'label',
curve: 'catmull-rom'
curve: 'catmull-rom',
tip: {
format: {
x: d => new Date(d).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
}),
y: v => `${v} SPs`,
label: true
}
}
})
]
})}
Expand Down Expand Up @@ -261,7 +294,7 @@ const tidy = clone(SparkRetrievalResultCodes).flatMap(({ day, rates }) => {
color: {
scheme: "Accent",
legend: "swatches",
label: "Codes"
label: "code"
},
marks: [
Plot.rectY(tidy, {
Expand All @@ -270,7 +303,18 @@ const tidy = clone(SparkRetrievalResultCodes).flatMap(({ day, rates }) => {
fill: "code",
offset: "normalize",
sort: {color: null, x: "-y" },
interval: 'day'
interval: 'day',
tip: {
format: {
x: d => new Date(d).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
}),
y: v => v.toFixed(2),
code: true
}
}
})
]
})}
Expand All @@ -283,12 +327,22 @@ const tidy = clone(SparkRetrievalResultCodes).flatMap(({ day, rates }) => {
${Plot.plot({
title: 'Time to First Byte (ms)',
x: { type: 'utc', ticks: 'month' },
y: { grid: true, zero: true},
y: { grid: true, zero: true, label: 'ttfb (ms)' },
marks: [
Plot.lineY(SparkRetrievalTimes, {
x: 'day',
y: 'ttfb_ms',
stroke: "#FFBD3F",
tip: {
format: {
x: d => new Date(d).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
}),
y: v => v.toFixed(0)
}
}
})
]
})}
Expand Down