-
Notifications
You must be signed in to change notification settings - Fork 3
shreds: flag lagging publishers on the shred publishers page #666
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
base: main
Are you sure you want to change the base?
Changes from all commits
1f7877e
8b1c7e9
5e75951
592ee77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,8 @@ type PublisherCheckItem struct { | |
| ValidatorName string `json:"validator_name"` | ||
| ValidatorVersionOk bool `json:"validator_version_ok"` | ||
| IsBackup bool `json:"is_backup"` | ||
| Lagging bool `json:"lagging"` | ||
| LaggingStatus string `json:"lagging_status"` | ||
| } | ||
|
|
||
| // PublisherCheckResponse is the response for the publisher check endpoint. | ||
|
|
@@ -325,6 +327,20 @@ func (a *API) FetchPublisherCheckData(ctx context.Context, q string, epochsParam | |
| publishers = []PublisherCheckItem{} | ||
| } | ||
|
|
||
| // Mark publishers whose validator is reported as lagging (status != Healthy) | ||
| // in dzf_data.lagged_validators. Non-fatal: if the lookup fails we still | ||
| // return publisher data without lagging annotations. | ||
| if lagging, err := a.fetchLaggedValidators(ctx); err != nil { | ||
| slog.Warn("publisher check: lagged validators query failed", "error", err) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The page-cache worker refreshes publisher_check every 30s, so any environment where the table is absent (local dev without remote tables) or the grant is missing logs this warning every 30s indefinitely. Consider skipping the lookup when |
||
| } else { | ||
| for i := range publishers { | ||
| if status, ok := lagging[publishers[i].VotePubkey]; ok { | ||
| publishers[i].Lagging = true | ||
| publishers[i].LaggingStatus = status | ||
| } | ||
| } | ||
| } | ||
|
|
||
| var totalNetworkStake int64 | ||
| err = a.envDB(ctx).QueryRow(ctx, | ||
| `SELECT COALESCE(SUM(activated_stake_lamports), 0) | ||
|
|
@@ -358,3 +374,34 @@ func (a *API) FetchPublisherCheckData(ctx context.Context, q string, epochsParam | |
| Publishers: publishers, | ||
| }, nil | ||
| } | ||
|
|
||
| // fetchLaggedValidators returns a map of validator vote pubkey to its lagging | ||
| // status for every validator currently reported as not Healthy in | ||
| // dzf_data.lagged_validators. | ||
| func (a *API) fetchLaggedValidators(ctx context.Context) (map[string]string, error) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The success path of this function is never verified anywhere. The test harness ( |
||
| start := time.Now() | ||
| query := fmt.Sprintf(` | ||
| SELECT validator_vote_public_key, status | ||
| FROM `+"`%s`"+`.lagged_validators | ||
| WHERE status != 'Healthy' AND validator_vote_public_key != ''`, a.DZFDataDB) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assumes the table holds only current state: no recency bound, no |
||
|
|
||
| rows, err := a.envDB(ctx).Query(ctx, query) | ||
| metrics.RecordClickHouseQuery("lagged_validators", time.Since(start), err) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| defer rows.Close() | ||
|
|
||
| lagging := make(map[string]string) | ||
| for rows.Next() { | ||
| var votePubkey, status string | ||
| if err := rows.Scan(&votePubkey, &status); err != nil { | ||
| return nil, fmt.Errorf("scan: %w", err) | ||
| } | ||
| lagging[votePubkey] = status | ||
| } | ||
| if err := rows.Err(); err != nil { | ||
| return nil, fmt.Errorf("rows: %w", err) | ||
| } | ||
| return lagging, nil | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,8 @@ type SortField = | |
| | "publishing_leader_shreds" | ||
| | "publishing_retransmitted" | ||
| | "leader_slots" | ||
| | "validator_client"; | ||
| | "validator_client" | ||
| | "lagging"; | ||
|
|
||
| type SortDirection = "asc" | "desc"; | ||
|
|
||
|
|
@@ -412,6 +413,9 @@ export function PublisherCheckPage() { | |
| `${b.validator_client} ${b.validator_version}`, | ||
| ); | ||
| break; | ||
| case "lagging": | ||
| cmp = Number(a.lagging) - Number(b.lagging); | ||
| break; | ||
| default: | ||
| cmp = 0; | ||
| } | ||
|
|
@@ -867,6 +871,10 @@ export function PublisherCheckPage() { | |
| No Retransmit Shreds | ||
| <SortIcon field="publishing_retransmitted" /> | ||
| </th> | ||
| <th className={thCenter} onClick={() => handleSort("lagging")}> | ||
| Fast Shreds | ||
| <SortIcon field="lagging" /> | ||
| </th> | ||
| <th | ||
| className={thCenter} | ||
| onClick={() => handleSort("leader_slots")} | ||
|
|
@@ -887,7 +895,7 @@ export function PublisherCheckPage() { | |
| {pagedPublishers.length === 0 ? ( | ||
| <tr> | ||
| <td | ||
| colSpan={13} | ||
| colSpan={14} | ||
| className="px-4 py-12 text-center text-muted-foreground" | ||
| > | ||
| {activeFilter | ||
|
|
@@ -974,6 +982,11 @@ export function PublisherCheckPage() { | |
| <td className="px-4 py-3 text-center"> | ||
| <StatusIcon ok={!pub.publishing_retransmitted} /> | ||
| </td> | ||
| <td className="px-4 py-3 text-center"> | ||
| <StatusIcon | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ok={pub.lagging_status !== "Action Needed"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This predicate disagrees with the backend and the sort. The backend sets |
||
| /> | ||
| </td> | ||
| <td className="px-4 py-3 text-sm tabular-nums text-center"> | ||
| {pub.leader_slots.toLocaleString()} | ||
| </td> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetDZFDataDBhas no callers — the env-var override inLoad()is the only write path. Drop the setter.