Skip to content

Monitoring - #4

Merged
dev-harsh1998 merged 1 commit into
masterfrom
feature/monitoring
Aug 8, 2025
Merged

Monitoring #4
dev-harsh1998 merged 1 commit into
masterfrom
feature/monitoring

Conversation

@yogeshnimangre007

Copy link
Copy Markdown
Collaborator

PR: Monitoring Dashboard & Accurate Byte Accounting

Summary

Add unified monitoring via /monitor (HTML dashboard + JSON API), correct byte accounting, documentation updates, and tests.

Changes

  • Feature: /monitor HTML dashboard (auto-refresh) and /monitor?json=1 JSON stats
  • Metrics: Requests, errors, bytes served (body only), uptime, upload statistics
  • Fix: Accurate bytes_served tracking in send_response
  • Tests: tests/monitor_test.rs (HTML presence, JSON schema subset, byte growth)
  • Docs: Updated README.md, doc/API_REFERENCE.md, doc/ARCHITECTURE.md; added doc/MONITORING.md
  • Refactor: Removed temporary counting wrapper; centralized stats recording in response path
  • Template: Embedded monitor page (no external assets)

JSON Schema (Excerpt)

{
  "requests": { "total": 0, "successful": 0, "errors": 0, "bytes_served": 0, "uptime_secs": 0 },
  "downloads": { "bytes_served": 0 },
  "uploads": {
    "total_uploads": 0, "successful_uploads": 0, "failed_uploads": 0,
    "files_uploaded": 0, "upload_bytes": 0, "average_upload_size": 0,
    "largest_upload": 0, "concurrent_uploads": 0,
    "average_processing_time": 0.0, "success_rate": 0.0
  }
}

Rationale

Provides built-in observability without external dependencies and fixes previously static download byte counter.

Verification

  • New monitor tests pass
  • Manual file download increases bytes_served
  • Existing endpoints unaffected (backward compatible)

Follow-Ups (Optional)

  • Active connection count
  • Per-endpoint metrics
  • Prometheus/OpenMetrics exporter
  • Rolling rate windows (RPS, throughput)
  • Optional auth toggle for /monitor

Checklist

  • Feature implemented
  • Tests added
  • Documentation updated
  • Formatting & lint clean
  • Backward compatible

@dev-harsh1998

Copy link
Copy Markdown
Owner

LGTM

@dev-harsh1998
dev-harsh1998 merged commit 267fc09 into master Aug 8, 2025
10 checks passed
@dev-harsh1998
dev-harsh1998 deleted the feature/monitoring branch August 8, 2025 21:09
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.

3 participants