Add prometheus class #12
Merged
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.
This pull request introduces a refactor and enhancement of the Prometheus metrics system for the template server. The main change is the extraction of custom metrics logic into a dedicated
prometheus_handler.pymodule, which centralizes metric definitions and operations. This improves maintainability and extensibility, and updates all relevant code and documentation to reflect the new architecture.Prometheus Metrics Refactor & Enhancement
Metrics System Refactor:
python_template_server/prometheus_handler.pymodule to encapsulate Prometheus metrics setup, metric definitions, and operations, replacing scattered metric logic with a reusable handler class. (prometheus_handler.pyis now referenced in docs and.github/copilot-instructions.md) [1] [2] [3]python_template_server/template_server.pyto use the newPrometheusHandlerfor all metric operations (incrementing counters, setting gauges) instead of direct metric objects, simplifying and standardizing metric usage. [1] [2] [3] [4] [5] [6]Metrics Model Improvements:
BaseMetricNames,MetricTypes,MetricConfig) topython_template_server/models.pyto define metric names, types, and configuration in a type-safe, extensible way. [1] [2]Documentation Updates:
.github/copilot-instructions.mdanddocs/SMG.mdto includeprometheus_handler.pyand describe the new metrics architecture. [1] [2]These changes make the metrics system easier to maintain, extend, and document, and prepare the codebase for future metric additions and improved observability.