Skip to content

Prometheus metrics and structured logging #17

@FumingPower3925

Description

@FumingPower3925

Summary

Prometheus-compatible metrics exposition and structured JSON logging for key system events.

Prometheus Metrics (SDD 12.3)

Exposed at /metrics when EnableMetrics: true.

Metric Type Labels
celeris_requests_total Counter method, path, status
celeris_request_duration_seconds Histogram method, path
celeris_connections_active Gauge engine
celeris_connections_total Counter engine
celeris_engine_switches_total Counter from, to
celeris_overload_stage Gauge
celeris_overload_escalations_total Counter from_stage, to_stage
celeris_syscalls_total Counter type
celeris_buffer_utilization Gauge worker
celeris_iouring_sq_utilization Gauge worker
celeris_iouring_tier Gauge

Structured Logging (SDD 12.2)

JSON format for key events:

  • Engine switch: {"event":"engine_switch","from":"iouring","to":"epoll","reason":"h2c_bias","timestamp":"..."}
  • Overload escalation: {"event":"overload_escalation","from_stage":1,"to_stage":2,"cpu_pct":82.5,"timestamp":"..."}
  • Overload de-escalation: similar format
  • Tier detection: {"event":"tier_detected","tier":"High","kernel":"5.19.0","features":["multishot_accept","pbuf"]}

Tests

  • All metrics registered with correct types and labels
  • /metrics endpoint returns valid Prometheus format
  • /metrics returns 404 when EnableMetrics: false
  • Log output is valid JSON
  • Engine switch event logged with correct fields
  • Overload escalation/de-escalation logged
  • Integration: generate traffic → scrape /metrics → verify counter increments

SDD Reference

Sections 12.2, 12.3

Dependencies

Depends on #14, #15

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions