Skip to content

Monitoring: Add telemetry collection for Phase 1 #4

@umwelt

Description

@umwelt

Context

Phase 1 requires telemetry collection for bug reports and performance monitoring during testnet. This fulfills the Phase 1 deliverable: "Gather telemetry, bug reports, and performance data".

Scope

  • Collect API request metrics (count, latency, errors)
  • Collect identity operation metrics (creation, login, recovery)
  • Collect DHT operation metrics (success rate, latency)
  • Store metrics in-memory with configurable retention
  • Endpoint: GET /api/v1/metrics
  • Prometheus-compatible metrics format

Dependencies

None - independent feature

Development Setup

Starting branch: feature/sid-integration (contains latest SID work)

Recommended workflow:

# Clone and checkout base branch
git checkout feature/sid-integration
git pull origin feature/sid-integration

# Create feature branch for this work
git checkout -b feature/telemetry

# Work on implementation
# When done, push and create PR to merge back to feature/sid-integration
git push origin feature/telemetry

Acceptance Criteria

  • API request counters by endpoint
  • Latency histograms (p50, p95, p99)
  • Error rate tracking by endpoint
  • Identity operations tracked (creates, logins, recoveries)
  • DHT operation success/failure rates
  • Metrics endpoint returns Prometheus format
  • In-memory storage with 24h retention
  • Unit tests for metric collection
  • Documentation on available metrics

Technical Notes

  • Use prometheus client library
  • Metrics: http_requests_total, http_request_duration_seconds, identity_operations_total, dht_operations_total
  • Keep metrics lightweight (no PII in labels)
  • Support for external monitoring systems (Grafana, etc.)
  • API handlers location: zhtp/zhtp/src/api/handlers/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions