Skip to content

[$25 BOUNTY] [TypeScript] Add reconnect metrics for frontend sockets - #130

Open
Saiaaax wants to merge 2 commits into
jaxassistant55:mainfrom
Saiaaax:bounty73-reconnect-metrics
Open

[$25 BOUNTY] [TypeScript] Add reconnect metrics for frontend sockets#130
Saiaaax wants to merge 2 commits into
jaxassistant55:mainfrom
Saiaaax:bounty73-reconnect-metrics

Conversation

@Saiaaax

@Saiaaax Saiaaax commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Adds a ReconnectMetrics class that tracks WebSocket reconnect attempts, successes, failures, consecutive failures, and backoff delay statistics for frontend sockets.

Closes #73

Changes

  • New: frontend/src/services/reconnectMetrics.tsReconnectMetrics class with:

    • recordAttempt(backoffMs) — track a reconnect attempt with its backoff delay
    • recordSuccess(backoffMs) — track a successful reconnect
    • recordFailure() — track a failed reconnect (gave up)
    • snapshot() — return current metrics as a plain object
    • reset() — clear all counters
    • Tracks: total attempts, successes, failures, consecutive failures, min/max/avg backoff, timestamps
  • New: frontend/src/services/reconnectMetrics.test.ts — 8 unit tests:

    • Starts with zero counts
    • Records attempts with backoff delay
    • Records successful reconnects
    • Records failures and consecutive failures
    • Resets consecutive failures on success
    • Tracks backoff statistics (min, max, average)
    • Handles zero backoff (initial attempt)
    • Resets all counters
    • Validates lastAttemptAt timestamp
  • Updated: docs/OPERATIONS.md — Added "Frontend WebSocket Reconnect Metrics" section

Testing

cd frontend && npm test -- --run reconnectMetrics

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

  • I would like to request that my diagnostic build log is removed before merging

Payout address: 0x5253757322092903C2F0a8EfEed592344216CC7E
Diagnostic artifact reference: diagnostic/build-bd0b6e82.logd

Saiaaax and others added 2 commits June 24, 2026 21:30
Add ReconnectMetrics class tracking reconnect attempts, successes,
failures, consecutive failures, and backoff delay statistics.
Include 8 unit tests and documentation in docs/OPERATIONS.md.

Closes #73

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[$25 BOUNTY] [TypeScript] Add reconnect metrics for frontend sockets

1 participant