Skip to content

Add telemetry & Prometheus metrics endpoint, tests, docs, and lint fixes#57

Merged
cybcon merged 13 commits intomainfrom
feature/open_telemetry
Feb 21, 2026
Merged

Add telemetry & Prometheus metrics endpoint, tests, docs, and lint fixes#57
cybcon merged 13 commits intomainfrom
feature/open_telemetry

Conversation

@cybcon
Copy link
Owner

@cybcon cybcon commented Feb 21, 2026

Summary

This PR adds a telemetry package to collect and expose Prometheus-compatible metrics (CPU, memory, load average, read/write counters), integrates metrics wiring into the server, and includes unit tests, examples, and documentation. It also contains linting updates and small persistence fixes.

What I changed

  • Added telemetry components:
    • src/app/lib/telemetry/metrics_datastore.py
    • src/app/lib/telemetry/metrics_server.py
    • src/app/lib/telemetry/prometheus_metrics.py
    • src/app/lib/telemetry/__init__.py
  • Integrated metrics into the server:
    • src/app/modbus_server.py (metrics wiring / endpoint integration)
    • src/app/modbus_server.json (config updates)
  • Tests:
    • Added/updated telemetry tests in tests/ (e.g., tests/test_metrics_datastore.py, tests/test_metrics_server.py, tests/test_prometheus_metrics.py)
  • Examples & docs:
    • Added examples/metrics_example.txt
    • Updated examples/abb_coretec_example.json, examples/test.json, examples/udp.json
    • Updated README.md with metrics documentation
  • Persistence & misc:
    • Tweaks to src/app/lib/register_persistence/__init__.py
  • Build / CI / linting:
    • .pre-commit-config.yaml updated; linter fixes applied
    • src/requirements.txt updated (ensure psutil present)
  • Containers:
    • Dockerfile and Dockerfile.test updated to expose metrics endpoint port

Files changed (high-level)

  • src/app/lib/telemetry/* (new/modified)
  • src/app/modbus_server.py
  • src/app/modbus_server.json
  • src/app/lib/register_persistence/__init__.py
  • src/requirements.txt
  • examples/metrics_example.txt, examples/*.json
  • Dockerfile, Dockerfile.test
  • .pre-commit-config.yaml
  • tests/* (new/updated telemetry tests)
  • README.md

Testing

  • Run the full test suite:
pytest
  • Verify metrics endpoint (default path and port described in updated README.md) returns Prometheus-format metrics.

@cybcon cybcon added the minor New Features label Feb 21, 2026
@cybcon cybcon merged commit 7425f5a into main Feb 21, 2026
26 of 27 checks passed
@cybcon cybcon deleted the feature/open_telemetry branch February 21, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant