Skip to content

Commit

Permalink
refactor(renterd): remove contracts metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Nov 27, 2024
1 parent 363237b commit eaf3d72
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 189 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-tomatoes-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

The contracts graphs no longer include a count metric.
5 changes: 0 additions & 5 deletions .changeset/shaggy-dolls-smash.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/two-seas-judge.md

This file was deleted.

20 changes: 0 additions & 20 deletions apps/renterd/components/Contracts/ContractMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export function ContractMetrics() {
selectedContract,
allContractsSpendingMetrics,
selectedContractSpendingMetrics,
contractsCountMetrics,
graphMode,
setGraphMode,
} = useContracts()
Expand All @@ -31,14 +30,6 @@ export function ContractMetrics() {
{stripPrefix(selectedContract.id).slice(0, 6)}
</Button>
)}
{!selectedContract && (
<Button
variant={graphMode === 'count' ? 'accent' : 'gray'}
onClick={() => setGraphMode('count')}
>
Count
</Button>
)}
</div>
)

Expand Down Expand Up @@ -66,17 +57,6 @@ export function ContractMetrics() {
emptyState={<StateNoData />}
/>
)}
{graphMode === 'count' && !selectedContract && (
<ChartXY
id="renterd/v0/contracts/graphs/count"
height="100%"
data={contractsCountMetrics.data}
config={contractsCountMetrics.config}
isLoading={contractsCountMetrics.isLoading}
actionsLeft={tabsEl}
emptyState={<StateNoData />}
/>
)}
</div>
)
}
4 changes: 0 additions & 4 deletions apps/renterd/contexts/contracts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { defaultDatasetRefreshInterval } from '../../config/swr'
import { useDataset } from './dataset'
import { useFilteredStats } from './useFilteredStats'
import { daysInMilliseconds } from '@siafoundation/units'
import { useContractsMetrics } from './useContractsMetrics'

const defaultLimit = 50

Expand Down Expand Up @@ -175,8 +174,6 @@ function useContractsMain() {
disabled: !selectedContract,
})

const { contractsMetrics: contractsCountMetrics } = useContractsMetrics()

return {
dataState,
limit,
Expand Down Expand Up @@ -215,7 +212,6 @@ function useContractsMain() {
selectContract,
allContractsSpendingMetrics,
selectedContractSpendingMetrics,
contractsCountMetrics,
isFetchingPrunableSizeAll,
isFetchingPrunableSizeById,
fetchPrunableSize,
Expand Down
6 changes: 1 addition & 5 deletions apps/renterd/contexts/contracts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const sortOptions: {
]

export type ViewMode = 'list' | 'detail'
export type GraphMode = 'spending' | 'count'
export type GraphMode = 'spending'

export type ChartContractKey =
| 'uploadSpending'
Expand All @@ -196,7 +196,3 @@ export type ChartContractCategory = 'funding' | 'spending'
export type ChartContractsKey = 'contracts'

export type ChartContractsCategory = never

export type ChartContractsChurnKey = 'contracts'

export type ChartContractsChurnCategory = never
77 changes: 0 additions & 77 deletions apps/renterd/contexts/contracts/useContractsMetrics.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions libs/renterd-js/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ import {
ContractRenewedPayload,
ContractRenewedResponse,
ContractResponse,
ContractsMetricsParams,
ContractsMetricsPayload,
ContractsMetricsResponse,
ContractsChurnMetricsParams,
ContractsChurnMetricsPayload,
ContractsChurnMetricsResponse,
ContractSizeParams,
ContractSizePayload,
ContractSizeResponse,
Expand Down Expand Up @@ -191,8 +185,6 @@ import {
busHostsBlocklistRoute,
busHostsHostKeyRoute,
busMetricContractRoute,
busMetricContractsRoute,
busMetricChurnRoute,
busMetricWalletRoute,
busMultipartAbortRoute,
busMultipartCompleteRoute,
Expand Down Expand Up @@ -560,16 +552,6 @@ export function Bus({ api, password }: { api: string; password?: string }) {
ContractMetricsPayload,
ContractMetricsResponse
>(axios, 'get', busMetricContractRoute),
contractsMetrics: buildRequestHandler<
ContractsMetricsParams,
ContractsMetricsPayload,
ContractsMetricsResponse
>(axios, 'get', busMetricContractsRoute),
contractsChurnMetrics: buildRequestHandler<
ContractsChurnMetricsParams,
ContractsChurnMetricsPayload,
ContractsChurnMetricsResponse
>(axios, 'get', busMetricChurnRoute),
walletMetrics: buildRequestHandler<
WalletMetricsParams,
WalletMetricsPayload,
Expand Down
17 changes: 0 additions & 17 deletions libs/renterd-react/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ import {
ContractRenewedPayload,
ContractRenewedResponse,
ContractResponse,
ContractsMetricsParams,
ContractsMetricsResponse,
ContractsChurnMetricsParams,
ContractsChurnMetricsResponse,
ContractsAddParams,
ContractsAddPayload,
ContractsAddResponse,
Expand Down Expand Up @@ -196,8 +192,6 @@ import {
busAlertsDismissRoute,
busSlabKeyObjectsRoute,
busMetricContractRoute,
busMetricContractsRoute,
busMetricChurnRoute,
busMetricWalletRoute,
busMultipartCreateRoute,
busMultipartRoute,
Expand Down Expand Up @@ -919,17 +913,6 @@ export function useMetricsContract(
return useGetSwr({ ...args, route: busMetricContractRoute })
}

export function useMetricsContracts(
args: HookArgsSwr<ContractsMetricsParams, ContractsMetricsResponse>
) {
return useGetSwr({ ...args, route: busMetricContractsRoute })
}
export function useMetricsContractsChurn(
args: HookArgsSwr<ContractsChurnMetricsParams, ContractsChurnMetricsResponse>
) {
return useGetSwr({ ...args, route: busMetricChurnRoute })
}

export function useMetricsWallet(
args: HookArgsSwr<WalletMetricsParams, WalletMetricsResponse>
) {
Expand Down
36 changes: 0 additions & 36 deletions libs/renterd-types/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export const busAlertsRoute = '/bus/alerts'
export const busAlertsDismissRoute = '/bus/alerts/dismiss'
export const busSlabKeyObjectsRoute = '/bus/slab/:key/objects'
export const busMetricContractRoute = '/bus/metric/contract'
export const busMetricContractsRoute = '/bus/metric/contracts'
export const busMetricChurnRoute = '/bus/metric/churn'
export const busMetricWalletRoute = '/bus/metric/wallet'
export const busMultipartRoute = '/bus/multipart'
export const busMultipartCreateRoute = '/bus/multipart/create'
Expand Down Expand Up @@ -523,26 +521,6 @@ export type ContractMetricsParams = MetricsParams & {
export type ContractMetricsPayload = void
export type ContractMetricsResponse = ContractMetric[]

export type ContractsMetric = {
contracts: number
timestamp: string
}
export type ContractsMetricsParams = MetricsParams
export type ContractsMetricsPayload = void
export type ContractsMetricsResponse = ContractsMetric[]
export type ContractsChurnMetric = {
direction: string
contractID: string
reason: string
timestamp: string
}
export type ContractsChurnMetricsParams = MetricsParams & {
direction?: string
reason?: string
}
export type ContractsChurnMetricsPayload = void
export type ContractsChurnMetricsResponse = ContractsChurnMetric[]

export type WalletMetric = {
timestamp: string
confirmed: string
Expand All @@ -554,20 +532,6 @@ export type WalletMetricsParams = MetricsParams
export type WalletMetricsPayload = void
export type WalletMetricsResponse = WalletMetric[]

// export type PerformanceMetric = {
// action: string
// hostKey: string
// origin: string
// duration: number
// timestamp: string
// }

// export type PerformanceMetricsParams = MetricsParams & {
// action: string
// hostKey: string
// origin: string
// }

// multipart

export type MultipartUploadCreateParams = void
Expand Down

0 comments on commit eaf3d72

Please sign in to comment.