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

hostd metrics improvements, renterd zen defaults #417

Merged
merged 7 commits into from
Nov 20, 2023
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
5 changes: 5 additions & 0 deletions .changeset/calm-coins-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

The configuration now has zen-specific suggested/default values for number of contract hosts and shard values.
5 changes: 0 additions & 5 deletions .changeset/friendly-dryers-type.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/great-games-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': minor
---

The revenue graph is now a bar stack, much more clearly showing earned vs potential revenue.
5 changes: 5 additions & 0 deletions .changeset/healthy-laws-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': minor
---

The metrics graphs now show a y-axis.
5 changes: 5 additions & 0 deletions .changeset/ninety-pots-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': minor
---

The ChartXY API has been refactored.
5 changes: 5 additions & 0 deletions .changeset/sweet-actors-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

The contract list now updates after a contract is deleted.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ The Sia web libraries provide developers with convenient TypeScript SDKs for usi
- [@siafoundation/sia-nodejs](libs/sia-nodejs) - Sia NodeJS client for controlling a v1 `siad`.
- [@siafoundation/design-system](libs/design-system) - React-based design system used across Sia apps and websites.
- [@siafoundation/data-sources](libs/data-sources) - Data sources used for stats on the website.
- [@siafoundation/fonts](libs/fonts) - Next font configuration for use across apps.
- [@siafoundation/units](libs/units) - Methods and types for converting and displaying units.

## Internal
Expand Down
27 changes: 2 additions & 25 deletions apps/explorer/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,8 @@ import { Layout } from '../components/Layout'
import '../config/style.css'
import { NextAppSsrAppRouter } from '@siafoundation/design-system'
import { appLink } from '../config'
import { IBM_Plex_Sans, IBM_Plex_Mono } from '@next/font/google'
import { cx } from 'class-variance-authority'
import Script from 'next/script'

const sans = IBM_Plex_Sans({
weight: ['100', '200', '300', '400', '500', '600', '700'],
style: ['normal', 'italic'],
subsets: ['latin'],
variable: '--font-sans',
display: 'swap',
preload: true,
})

const mono = IBM_Plex_Mono({
weight: ['100', '200', '300', '400', '500', '600', '700'],
style: ['normal', 'italic'],
subsets: ['latin'],
variable: '--font-mono',
display: 'swap',
preload: true,
})
import { rootFontClasses } from '@siafoundation/fonts'

export const metadata = {
title: 'Explorer',
Expand All @@ -40,11 +21,7 @@ export default function RootLayout({
children: React.ReactNode
}) {
return (
<html
lang="en"
suppressHydrationWarning
className={cx(sans.variable, mono.variable)}
>
<html lang="en" suppressHydrationWarning className={rootFontClasses}>
<body>
<NextAppSsrAppRouter>
<Layout>{children}</Layout>
Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
'/node_modules/(?!d3|d3-array|d3-axis|d3-brush|d3-chord|d3-color|d3-contour|d3-delaunay|d3-dispatch|d3-drag|d3-dsv|d3-ease|d3-fetch|d3-force|d3-format|d3-geo|d3-hierarchy|d3-interpolate|d3-path|d3-polygon|d3-quadtree|d3-random|d3-scale|d3-scale-chromatic|d3-selection|d3-shape|d3-time|d3-time-format|d3-timer|d3-transition|d3-zoom}|internmap|d3-delaunay|delaunator|robust-predicates)',
],
moduleNameMapper: {
'@next/font/(.*)': require.resolve(
'next/font/(.*)': require.resolve(
'next/dist/build/jest/__mocks__/nextFontMock.js'
),
},
Expand Down
1 change: 0 additions & 1 deletion apps/hostd/components/Home/HomeBandwidth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function HomeBandwidth() {
data={bandwidth.data}
config={bandwidth.config}
isLoading={bandwidth.isLoading}
chartType={bandwidth.chartType}
actionsLeft={
<>
<Text font="mono" weight="semibold">
Expand Down
1 change: 0 additions & 1 deletion apps/hostd/components/Home/HomeCollateral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export function HomeCollateral() {
data={collateral.data}
config={collateral.config}
isLoading={collateral.isLoading}
chartType={collateral.chartType}
height={300}
/>
</div>
Expand Down
1 change: 0 additions & 1 deletion apps/hostd/components/Home/HomeContracts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export function HomeContracts() {
data={contracts.data}
config={contracts.config}
isLoading={contracts.isLoading}
chartType={contracts.chartType}
height={300}
/>
</div>
Expand Down
1 change: 0 additions & 1 deletion apps/hostd/components/Home/HomeOperations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export function HomeOperations() {
data={operations.data}
config={operations.config}
isLoading={operations.isLoading}
chartType={operations.chartType}
actionsLeft={
<>
<Text font="mono" weight="semibold">
Expand Down
1 change: 0 additions & 1 deletion apps/hostd/components/Home/HomePricing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export function HomePricing() {
data={pricing.data}
config={pricing.config}
isLoading={pricing.isLoading}
chartType={pricing.chartType}
actionsLeft={
<>
<Text font="mono" weight="semibold">
Expand Down
1 change: 0 additions & 1 deletion apps/hostd/components/Home/HomeRevenue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export function HomeRevenue() {
data={revenue.data}
config={revenue.config}
isLoading={revenue.isLoading}
chartType={revenue.chartType}
actionsLeft={
<>
<Text font="mono" weight="semibold">
Expand Down
1 change: 0 additions & 1 deletion apps/hostd/components/Home/HomeStorage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export function HomeStorage() {
data={storage.data}
config={storage.config}
isLoading={storage.isLoading}
chartType={storage.chartType}
actionsLeft={
<>
<Text font="mono" weight="semibold">
Expand Down
51 changes: 43 additions & 8 deletions apps/hostd/contexts/metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
minutesInMilliseconds,
ValueScFiat,
} from '@siafoundation/design-system'
import { humanBytes, humanNumber } from '@siafoundation/sia-js'
import { humanBytes, humanNumber, humanSiacoin } from '@siafoundation/sia-js'
import { useCallback, useMemo } from 'react'
import { chartConfigs } from '../../config/charts'
import { useMetricsPeriod } from '@siafoundation/react-hostd'
Expand Down Expand Up @@ -253,10 +253,16 @@ function useMetricsMain() {
formatComponent: function ({ value }) {
return <ValueScFiat variant="value" value={new BigNumber(value)} />
},
formatTickY: (v) =>
humanSiacoin(v, {
fixed: 0,
dynamicUnits: true,
}),
formatTimestamp,
disableAnimations,
chartType: 'barstack',
stackOffset: 'diverging',
},
chartType: 'line',
isLoading: metricsPeriod.isValidating,
}
}, [metricsPeriod, formatTimestamp])
Expand Down Expand Up @@ -289,9 +295,16 @@ function useMetricsMain() {
return <ValueScFiat variant="value" value={new BigNumber(value)} />
},
formatTimestamp,
formatTickY: (v) =>
humanSiacoin(v, {
fixed: 0,
dynamicUnits: true,
}),
disableAnimations,
chartType: 'area',
curveType: 'linear',
stackOffset: 'none',
},
chartType: 'area',
isLoading: metricsPeriod.isValidating,
}
}, [metricsPeriod, formatTimestamp])
Expand Down Expand Up @@ -354,9 +367,16 @@ function useMetricsMain() {
return <ValueScFiat variant="value" value={new BigNumber(value)} />
},
formatTimestamp,
formatTickY: (v) =>
humanSiacoin(v, {
fixed: 0,
dynamicUnits: true,
}),
disableAnimations,
chartType: 'line',
curveType: 'linear',
stackOffset: 'none',
},
chartType: 'line',
isLoading: metricsPeriod.isValidating,
}
}, [metricsPeriod, formatTimestamp])
Expand Down Expand Up @@ -391,9 +411,12 @@ function useMetricsMain() {
},
format: (v) => `${v} contracts`,
formatTimestamp,
formatTickY: (v) => humanNumber(v),
disableAnimations,
chartType: 'areastack',
curveType: 'linear',
stackOffset: 'none',
},
chartType: 'areastack',
isLoading: metricsPeriod.isValidating,
}
}, [metricsPeriod, formatTimestamp])
Expand Down Expand Up @@ -473,9 +496,12 @@ function useMetricsMain() {
},
format: (v) => humanBytes(v),
formatTimestamp,
formatTickY: (v) => humanBytes(v, { fixed: 0 }),
disableAnimations,
chartType: 'line',
curveType: 'linear',
stackOffset: 'none',
},
chartType: 'line',
isLoading: metricsPeriod.isValidating,
}
}, [metricsPeriod, formatTimestamp])
Expand Down Expand Up @@ -515,10 +541,13 @@ function useMetricsMain() {
storageWrites: chartConfigs.storageWrites,
},
format: (v) => humanNumber(v),
formatTickY: (v) => humanNumber(v),
formatTimestamp,
disableAnimations,
chartType: 'line',
curveType: 'linear',
stackOffset: 'none',
},
chartType: 'line',
isLoading: metricsPeriod.isValidating,
}
}, [metricsPeriod, formatTimestamp])
Expand All @@ -545,9 +574,15 @@ function useMetricsMain() {
},
format: (v) => humanBytes(v),
formatTimestamp,
formatTickY: (v) =>
humanBytes(v, {
fixed: 0,
}),
disableAnimations,
chartType: 'line',
curveType: 'linear',
stackOffset: 'none',
},
chartType: 'line',
isLoading: metricsPeriod.isValidating,
}
}, [metricsPeriod, formatTimestamp])
Expand Down
6 changes: 3 additions & 3 deletions apps/hostd/contexts/metrics/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ export const dataTimeSpanOptions: {
}[] = [
{
label: '1D',
interval: '5m',
interval: '15m',
value: '1',
},
{
label: '7D',
interval: '15m',
interval: 'hourly',
value: '7',
},
{
label: '1M',
interval: 'hourly',
interval: 'daily',
value: '30',
},
{
Expand Down
2 changes: 1 addition & 1 deletion apps/hostd/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
'/node_modules/(?!d3|d3-array|d3-axis|d3-brush|d3-chord|d3-color|d3-contour|d3-delaunay|d3-dispatch|d3-drag|d3-dsv|d3-ease|d3-fetch|d3-force|d3-format|d3-geo|d3-hierarchy|d3-interpolate|d3-path|d3-polygon|d3-quadtree|d3-random|d3-scale|d3-scale-chromatic|d3-selection|d3-shape|d3-time|d3-time-format|d3-timer|d3-transition|d3-zoom}|internmap|d3-delaunay|delaunator|robust-predicates)',
],
moduleNameMapper: {
'@next/font/(.*)': require.resolve(
'next/font/(.*)': require.resolve(
'next/dist/build/jest/__mocks__/nextFontMock.js'
),
},
Expand Down
2 changes: 2 additions & 0 deletions apps/hostd/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NextAppCsr } from '@siafoundation/design-system'
import { AppProps } from 'next/app'
import { Providers } from '../config/providers'
import { routes } from '../config/routes'
import { rootFontClasses } from '@siafoundation/fonts'

export default function App({
Component,
Expand All @@ -12,6 +13,7 @@ export default function App({
}>) {
return (
<NextAppCsr
className={rootFontClasses}
fallback={pageProps.fallback}
passwordProtectRequestHooks
lockRoutes={routes}
Expand Down
24 changes: 22 additions & 2 deletions apps/hostd/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
import { NextDocument } from '@siafoundation/design-system'
'use client'

export default NextDocument
import DefaultNextDocument, {
Head,
Html,
Main,
NextScript,
} from 'next/document'
import { rootFontClasses } from '@siafoundation/fonts'

export default class NextDocument extends DefaultNextDocument {
override render() {
return (
<Html lang="en">
<Head />
<body className={rootFontClasses}>
<Main />
<NextScript />
</body>
</Html>
)
}
}
22 changes: 5 additions & 17 deletions apps/renterd/components/Files/EmptyState/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { CloudUpload32 } from '@siafoundation/react-icons'
import { routes } from '../../../config/routes'
import { useFiles } from '../../../contexts/files'
import { useAutopilotNotConfigured } from '../checks/useAutopilotNotConfigured'
import { useUploadPackingSettings } from '../../../hooks/useUploadPackingSettings'
import { useNotEnoughContracts } from '../checks/useNotEnoughContracts'
import { StateError } from './StateError'
import { StateNoneMatching } from './StateNoneMatching'
Expand All @@ -14,7 +13,6 @@ export function EmptyState() {

const autopilotNotConfigured = useAutopilotNotConfigured()
const notEnoughContracts = useNotEnoughContracts()
const uploadPacking = useUploadPackingSettings()

if (dataState === 'noneMatchingFilters') {
return <StateNoneMatching />
Expand Down Expand Up @@ -62,21 +60,11 @@ export function EmptyState() {
<CloudUpload32 className="scale-[200%]" />
</Text>
<div className="flex flex-col gap-4 justify-center items-center">
{uploadPacking.data?.enabled ? (
<Text color="subtle" className="text-center max-w-[500px]">
Drag and drop files or click here to start uploading. Redundancy
is configured to use {notEnoughContracts.required} shards which
means at least that many contracts are required. Small files can
be uploaded before contracts have formed but larger files will
fail to upload.
</Text>
) : (
<Text color="subtle" className="text-center max-w-[500px]">
There are not enough contracts to upload data yet. Redundancy is
configured to use {notEnoughContracts.required} shards which means
at least that many contracts are required.
</Text>
)}
<Text color="subtle" className="text-center max-w-[500px]">
There are not enough contracts to upload data yet. Redundancy is
configured to use {notEnoughContracts.required} shards which means
at least that many contracts are required.
</Text>
<Text size="30" className="text-center max-w-[500px]">
{notEnoughContracts.count}/{notEnoughContracts.required}
</Text>
Expand Down
Loading