This repository was archived by the owner on Jan 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Add linter #22
Merged
Merged
Add linter #22
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
92a4f80
add `standard`
juliangruber 873ef92
fix JSON
juliangruber c052d6b
add `test` workflow
juliangruber 45a3934
switch to prettier
juliangruber eadea09
switch to single quotes
juliangruber 167fcb1
remove semis
juliangruber 42f19c3
prettier ignore
juliangruber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Test Observable Dashboard | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| environment: default | ||
|
|
||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Test project | ||
| run: npm test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| src/.observablehq | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "singleQuote": true, | ||
| "semi": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,58 +1,58 @@ | ||
| import * as Plot from 'npm:@observablehq/plot' | ||
| import * as d3 from 'd3' | ||
|
|
||
| export function Histogram (events, { width, title, thresholds }) { | ||
| const data = events.flatMap(d => { | ||
| let res = Array.from([ { type: 'HTTP or Graphsync', value: d.success_rate * 100 }]); | ||
| export function Histogram(events, { width, title, thresholds }) { | ||
| const data = events.flatMap((d) => { | ||
| const res = Array.from([ | ||
| { type: 'HTTP or Graphsync', value: d.success_rate * 100 }, | ||
| ]) | ||
| // We only want to count the http success rate if it is not null | ||
| // When querying the summary per miner, an http of null means that the miner has never been tested using http | ||
| // A value of 0 means that the miner has been tested at some point in time but has never been successful. | ||
| // A value of 0 means that the miner has been tested at some point in time but has never been successful. | ||
| if (d.success_rate_http != null) { | ||
| res.push({ type: 'HTTP only', value: d.success_rate_http * 100 }) | ||
| res.push({ type: 'HTTP only', value: d.success_rate_http * 100 }) | ||
| } | ||
| return res | ||
| } | ||
| ) | ||
| }) | ||
|
|
||
| // We want to create a number of evenly spaced bins (thresholds) in which we can collect each success rate value into | ||
| const binnedData = Array.from(new Set(data.map(item => item.type))).flatMap(type => { | ||
| const groupData = data.filter(d => d.type === type) | ||
| const bins = d3 | ||
| .bin() | ||
| // The rates are percentage values, so the domain of the bins will be 0 to 100 | ||
| .domain([0, 100]) | ||
| .thresholds(thresholds)(groupData.map(d => d.value)) | ||
| // We want to create a number of evenly spaced bins (thresholds) in which we can collect each success rate value into | ||
| const binnedData = Array.from(new Set(data.map((item) => item.type))).flatMap( | ||
| (type) => { | ||
| const groupData = data.filter((d) => d.type === type) | ||
| const bins = d3 | ||
| .bin() | ||
| // The rates are percentage values, so the domain of the bins will be 0 to 100 | ||
| .domain([0, 100]) | ||
| .thresholds(thresholds)(groupData.map((d) => d.value)) | ||
|
|
||
| return bins.map(bin => ({ | ||
| type, | ||
| threshold: `${bin.x0}–${bin.x1}`, | ||
| count: bin.length | ||
| })) | ||
| }) | ||
| return bins.map((bin) => ({ | ||
| type, | ||
| threshold: `${bin.x0}–${bin.x1}`, | ||
| count: bin.length, | ||
| })) | ||
| }, | ||
| ) | ||
|
|
||
| return Plot.plot({ | ||
| marks: [ | ||
| Plot.barY( | ||
| binnedData, | ||
| { | ||
| fx: 'threshold', | ||
| y: 'count', | ||
| x: 'type', | ||
| fill: 'type' | ||
| } | ||
| ) | ||
| Plot.barY(binnedData, { | ||
| fx: 'threshold', | ||
| y: 'count', | ||
| x: 'type', | ||
| fill: 'type', | ||
| }), | ||
| ], | ||
| y: { grid: true }, | ||
| x: { | ||
| axis: null, | ||
| padding: 0.1 | ||
| padding: 0.1, | ||
| }, | ||
| color: { | ||
| legend: true, | ||
| label: 'Type' | ||
| label: 'Type', | ||
| }, | ||
| width, | ||
| title, | ||
| facet: { label: 'Rate Ranges in %' } | ||
| facet: { label: 'Rate Ranges in %' }, | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 17 additions & 11 deletions
28
src/data/[provider]-spark-retrieval-timings-summary.json.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,23 @@ | ||
| import pRetry from 'p-retry'; | ||
| import { jsonFetcher } from "./json-fetcher.js"; | ||
| import { getDateXDaysAgo } from "../utils/date-utils.js"; | ||
| import { parseArgs } from "node:util"; | ||
| import pRetry from 'p-retry' | ||
| import { jsonFetcher } from './json-fetcher.js' | ||
| import { getDateXDaysAgo } from '../utils/date-utils.js' | ||
| import { parseArgs } from 'node:util' | ||
|
|
||
| const { | ||
| values: { provider } | ||
| values: { provider }, | ||
| } = parseArgs({ | ||
| options: { provider: { type: "string" } } | ||
| }); | ||
| options: { provider: { type: 'string' } }, | ||
| }) | ||
|
|
||
| const start = '2025-01-14'; | ||
| const end = getDateXDaysAgo(1); | ||
| const start = '2025-01-14' | ||
| const end = getDateXDaysAgo(1) | ||
|
|
||
| const summary = await pRetry(() => jsonFetcher(`https://stats.filspark.com/miner/${provider}/retrieval-timings/summary?from=${start}&to=${end}`), { retries: 3 }); | ||
| const summary = await pRetry( | ||
| () => | ||
| jsonFetcher( | ||
| `https://stats.filspark.com/miner/${provider}/retrieval-timings/summary?from=${start}&to=${end}`, | ||
| ), | ||
| { retries: 3 }, | ||
| ) | ||
|
|
||
| process.stdout.write(JSON.stringify(summary)); | ||
| process.stdout.write(JSON.stringify(summary)) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.