Add telemetry & Prometheus metrics endpoint, tests, docs, and lint fixes#57
Merged
Add telemetry & Prometheus metrics endpoint, tests, docs, and lint fixes#57
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
src/app/lib/telemetry/metrics_datastore.pysrc/app/lib/telemetry/metrics_server.pysrc/app/lib/telemetry/prometheus_metrics.pysrc/app/lib/telemetry/__init__.pysrc/app/modbus_server.py(metrics wiring / endpoint integration)src/app/modbus_server.json(config updates)tests/(e.g.,tests/test_metrics_datastore.py,tests/test_metrics_server.py,tests/test_prometheus_metrics.py)examples/metrics_example.txtexamples/abb_coretec_example.json,examples/test.json,examples/udp.jsonREADME.mdwith metrics documentationsrc/app/lib/register_persistence/__init__.py.pre-commit-config.yamlupdated; linter fixes appliedsrc/requirements.txtupdated (ensurepsutilpresent)DockerfileandDockerfile.testupdated to expose metrics endpoint portFiles changed (high-level)
src/app/lib/telemetry/*(new/modified)src/app/modbus_server.pysrc/app/modbus_server.jsonsrc/app/lib/register_persistence/__init__.pysrc/requirements.txtexamples/metrics_example.txt,examples/*.jsonDockerfile,Dockerfile.test.pre-commit-config.yamltests/*(new/updated telemetry tests)README.mdTesting
README.md) returns Prometheus-format metrics.