feat(engine): add Prometheus /metrics endpoint for HTTP requests, chaos faults, and SEP-24 states

Open
#11 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
58/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
fastapi, prometheus, python

Research direction

Read engine/app/main.py, engine/app/chaos.py, and engine/app/inspector.py, then check how ChaosState and Sep24Transaction are represented. Add the endpoint and metrics coverage in engine/app/metrics.py and engine/tests/test_metrics.py; update engine/requirements.txt as needed. Done means /metrics returns the specified Prometheus format, exports the requested metrics, is protected from chaos and traffic-buffer noise, and the pytest suite passes.

Written by the indexing model from the issue text.

Description

complexity: medium engine

Context

engine currently exposes an in-memory traffic ring buffer (/admin/traffic) and structured JSON logs, plus in-memory chaos counters in ChaosState. Exposing a standard Prometheus /metrics scrape endpoint enables local Grafana/Prometheus dashboards and quantitative SLA monitoring during chaos fault injection tests.

Target Files

  • Create engine/app/metrics.py
  • Create engine/tests/test_metrics.py
  • Modify engine/app/main.py
  • Modify engine/app/chaos.py (PROTECTED_PREFIXES)
  • Modify engine/app/inspector.py
  • Modify engine/requirements.txt

Acceptance Criteria

  • Add GET /metrics returning Prometheus text exposition format (text/plain; version=0.0.4; charset=utf-8).
  • Export HTTP request counters (labeled by method, normalized path, and status_code) and request duration metrics.
  • Export Chaos Engine gauges/counters reflecting ChaosState (total_inspected, injected_errors, injected_delays) and SEP-24 transaction totals grouped by kind and status from Sep24Transaction.
  • Exempt /metrics from chaos fault injection (PROTECTED_PREFIXES) and /admin/traffic ring-buffer noise.
  • Add pytest coverage in engine/tests/test_metrics.py and verify pytest -v passes in CI.
Dominant language
Python
Stars
0
Forks
1
Avg merge
19h 43m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sepbox-dev/sepbox

All issues in sepbox-dev/sepbox

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.