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

[PROTO-1641] Add unregistered nodes to healthz in yellow #7366

Merged
merged 1 commit into from
Jan 29, 2024
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
13 changes: 13 additions & 0 deletions monitoring/healthz/src/pages/Nodes.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
--unreachable-shadow-color: rgba(0, 0, 0, 0.1);
--is-unhealthy-color: #fff0f0;
--is-unhealthy-hover-color: rgba(255, 200, 200, 0.4);
--is-unregistered-color: #fffbe6;
--is-unregistered-hover-color: rgba(255, 255, 176, 0.4);
}

/* Dark mode */
Expand All @@ -15,6 +17,8 @@
--unreachable-shadow-color: rgba(255, 255, 255, 0.1);
--is-unhealthy-color: #440000;
--is-unhealthy-hover-color: rgba(255, 50, 50, 0.4);
--is-unregistered-color: #665500;
--is-unregistered-hover-color: rgba(255, 255, 100, 0.4);
}
}

Expand Down Expand Up @@ -48,4 +52,13 @@
table tr:hover td.is-unhealthy,
table tr.is-unhealthy:hover td {
background: var(--is-unhealthy-hover-color);
}

.is-unregistered {
background: var(--is-unregistered-color);
}

table tr:hover td.is-unregistered,
table tr.is-unregistered:hover td {
background: var(--is-unregistered-hover-color);
}
71 changes: 48 additions & 23 deletions monitoring/healthz/src/pages/Nodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,49 @@ function HealthRow({ isContent, sp, isStaging }: { isContent: boolean; sp: SP, i
const health = data?.data
const yourIp = ipCheck?.data

if (!health || !yourIp)
// API response doesn't include isRegistered
if (sp.isRegistered !== false) {
sp.isRegistered = true
}

if (!health || !yourIp) {
let healthStatus = 'loading'
let healthStatusClass = ''
if (!sp.isRegistered) {
healthStatus = 'Unregistered'
healthStatusClass = 'is-unregistered'
} else if (dataError || ipCheckError) {
healthStatus = 'error'
healthStatusClass = 'is-unhealthy'
}
return (
<tr className={dataError || ipCheckError ? 'is-unhealthy' : ''}>
<tr className={healthStatusClass}>
<td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">
<a href={sp.endpoint + path} target="_blank">
{sp.endpoint.replace('https://', '')}
</a>
</td>
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Node Health */}
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Block Diff */}
<td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td> {/* Version */}
{isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Storage */}
{isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Fast Repair (checked, pulled, deleted) */}
{isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Full Repair (checked, pulled, deleted) */}
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{relayHealthError || ipCheckError ? 'error' : 'loading'}</td>} {/* Relay */}
<td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td> {/* DB Size */}
<td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td> {/* Your IP */}
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* ACDC Health */}
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Is Signer */}
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Peers */}
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Producing */}
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* ACDC Block */}
{!isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* ACDC Block Hash */}
{isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Started */}
{isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Uploads */}
{isContent && <td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Healthy Peers */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{healthStatus}</td>} {/* Node Health */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Block Diff */}
<td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td> {/* Version */}
{isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Storage */}
{isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Fast Repair (checked, pulled, deleted) */}
{isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Full Repair (checked, pulled, deleted) */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{relayHealthError || ipCheckError ? 'error' : 'loading'}</td>} {/* Relay */}
<td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td> {/* DB Size */}
<td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td> {/* Your IP */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* ACDC Health */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Is Signer */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Peers */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Producing */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* ACDC Block */}
{!isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* ACDC Block Hash */}
{isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Started */}
{isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Uploads */}
{isContent && <td className="whitespace-nowrap px-3 py-5 text-sm">{dataError || ipCheckError ? 'error' : 'loading'}</td>} {/* Healthy Peers */}
</tr>
)
}

// calculate healthy peers counts
const now = new Date()
Expand Down Expand Up @@ -152,7 +167,7 @@ function HealthRow({ isContent, sp, isStaging }: { isContent: boolean; sp: SP, i
const MAX_STORAGE_SIZE = isStaging ? 400 : 4000
const totalMediorumSize = mediorumDiskSize && health.blobStorePrefix === 'file' ? mediorumDiskSize : MAX_STORAGE_SIZE

const isBehind = health.block_difference > 5 ? 'is-unhealthy' : ''
const isBehind = 'whitespace-nowrap px-3 py-5 text-sm' + (health.block_difference > 5 ? ' is-unhealthy' : '')
const dbSize =
bytesToGb(health.database_size) || bytesToGb(health.databaseSize)
const isDbLocalhost = health.database_is_localhost || health.isDbLocalhost
Expand Down Expand Up @@ -188,14 +203,24 @@ function HealthRow({ isContent, sp, isStaging }: { isContent: boolean; sp: SP, i
)
}

let healthStatus = 'Healthy'
let healthStatusClass = ''
if (!sp.isRegistered) {
healthStatus = 'Unregistered'
healthStatusClass = 'is-unregistered'
} else if (!isHealthy) {
healthStatus = 'Unhealthy'
healthStatusClass = 'is-unhealthy'
}

return (
<tr className={isHealthy ? '' : 'is-unhealthy'}>
<tr className={healthStatusClass}>
<td className="whitespace-nowrap py-5 pl-4 pr-3 text-sm">
<a href={sp.endpoint + path} target="_blank" className="text-gray-900 dark:text-gray-200 hover:text-blue-500 dark:hover:text-blue-400">
{sp.endpoint.replace('https://', '')}
</a>
</td>
{!isContent && (<td className="whitespace-nowrap px-3 py-5 text-sm">{`${isHealthy ? 'Healthy' : 'Unhealthy: ' + health.errors}`}</td>)}
{!isContent && (<td className="whitespace-nowrap px-3 py-5 text-sm">{`${healthStatus}${healthStatus === 'Unhealthy' ? ': ' + health.errors : ''}`}</td>)}
{!isContent && <td className={isBehind}>{health.block_difference}</td>}
<td className="whitespace-nowrap px-3 py-5 text-sm flex flex-col">
<div className="flex items-center">
Expand Down
37 changes: 37 additions & 0 deletions monitoring/healthz/src/useServiceProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export function useServiceProviders(
const { data: sps, error } = useSWR<SP[]>([env, type], async () => {
const sps = await apiGatewayFetcher(env, type)
hostSort(sps)
if (type === 'discovery') {
sps.push(...unregisteredNodes(env === 'prod'))
}
return sps
})
return { data: sps, error }
Expand All @@ -76,3 +79,37 @@ export function hostSort(sps: SP[]) {
new URL(sp.endpoint).hostname.split('.').reverse().join('.')
sps.sort((a, b) => (hostSortKey(a) < hostSortKey(b) ? -1 : 1))
}

function unregisteredNodes(prod: boolean) {
if (prod) {
return [
{
delegateOwnerWallet: '0x32bF5092890bb03A45bd03AaeFAd11d4afC9a851',
endpoint: 'https://discoveryprovider4.audius.co',
isRegistered: false,
type: { id: 'discovery-node' },
},
{
delegateOwnerWallet: 'Metabase (no wallet)',
endpoint: 'https://insights.audius.co',
isRegistered: false,
type: { id: 'discovery-node' },
},
]
} else {
return [
{
delegateOwnerWallet: '0xb1C931A9ac123866372CEbb6bbAF50FfD18dd5DF',
endpoint: 'https://discoveryprovider4.staging.audius.co',
isRegistered: false,
type: { id: 'discovery-node' },
},
{
delegateOwnerWallet: 'DDEX (no wallet)',
endpoint: 'https://audius-stage.ddex.audius.co',
isRegistered: false,
type: { id: 'discovery-node' },
},
]
}
}