Correct retry attempt statistics for TransactionRetryManager#4195
Merged
Correct retry attempt statistics for TransactionRetryManager#4195
Conversation
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copilot stopped work on behalf of
makr-code due to an error
March 13, 2026 19:15
Copilot stopped work on behalf of
makr-code due to an error
March 13, 2026 19:53
There was a problem hiding this comment.
Pull request overview
Adds a per-category breakdown for legacy config-path fallback metrics and wires config metrics into a Prometheus registry, updating focused tests and test link dependencies accordingly.
Changes:
- Track legacy fallback counts per inferred config category in
ConfigPathResolver. - Update
ConfigMetricsExporterto exportthemis_config_legacy_fallbacks_total{category=...}and addregisterWithRegistry(); initialize a registry inmain_server. - Adjust config-metrics focused tests and link settings in
tests/CMakeLists.txt.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_config_path_resolver.cpp | Updates metric name expectations to the new per-category legacy fallback metric. |
| tests/test_config_metrics_scrape.cpp | Updates scrape assertions to require category-labeled legacy fallback series and removes deprecated metric checks. |
| tests/CMakeLists.txt | Adds yaml-cpp/OpenSSL and conditional prometheus-cpp link targets for focused config tests. |
| src/main_server.cpp | Creates a Prometheus registry at startup and registers config metrics. |
| src/config/config_path_resolver.h | Declares APIs and storage for per-category legacy fallback counters. |
| src/config/config_path_resolver.cpp | Implements per-category counter initialization/snapshot and increments on legacy fallback. |
| src/config/config_metrics_exporter.h | Updates exported metric list and adds registerWithRegistry() API. |
| src/config/config_metrics_exporter.cpp | Implements registry-backed export path, delta-updated counters, and per-category series wiring. |
You can also share your feedback on Copilot code review. Take the survey.
src/config/config_path_resolver.cpp
Outdated
Comment on lines
+1418
to
+1422
| const std::string category_path = new_path.empty() ? normalized : new_path; | ||
| const std::string category = inferCategory(category_path); | ||
| auto it = legacy_fallbacks_by_category_.find(category); | ||
| if (it != legacy_fallbacks_by_category_.end()) { | ||
| it->second.fetch_add(1, std::memory_order_relaxed); |
Comment on lines
31
to
+35
| #include <sstream> | ||
| #include <prometheus/counter.h> | ||
| #include <prometheus/gauge.h> | ||
| #include <prometheus/registry.h> | ||
| #include <prometheus/text_serializer.h> |
Comment on lines
+81
to
+86
| /** | ||
| * Register Prometheus metric families for config path resolution in the | ||
| * provided registry. Should be invoked during server startup so scrape | ||
| * handlers can serialize the registry without additional setup. | ||
| */ | ||
| static void registerWithRegistry(const std::shared_ptr<prometheus::Registry>& registry); |
Comment on lines
+278
to
+279
| // Also expose an aggregate series without label for convenience | ||
| g_metrics.legacy_fallbacks = &legacy_family.Add({}); |
Comment on lines
+360
to
+362
| // Initialize Prometheus registry for config path resolution metrics | ||
| g_config_prom_registry = std::make_shared<prometheus::Registry>(); | ||
| config::ConfigMetricsExporter::registerWithRegistry(g_config_prom_registry); |
tests/CMakeLists.txt
Outdated
| spdlog::spdlog | ||
| nlohmann_json::nlohmann_json | ||
| Threads::Threads | ||
| yaml-cpp |
tests/CMakeLists.txt
Outdated
| spdlog::spdlog | ||
| nlohmann_json::nlohmann_json | ||
| Threads::Threads | ||
| yaml-cpp |
Comment on lines
46
to
53
| * Exported metric names: | ||
| * themis_config_resolution_hits_total - counter | ||
| * themis_config_resolution_misses_total - counter | ||
| * themis_config_legacy_fallbacks_total - counter | ||
| * themis_config_new_path_hits_total - counter | ||
| * themis_config_legacy_fallbacks_total{category} - counter (per-category breakdown) | ||
| * themis_config_unmapped_requests_total - counter | ||
| * themis_config_cache_hits_total - counter | ||
| * themis_config_cache_misses_total - counter | ||
| * themis_config_cache_hit_ratio - gauge (derived) | ||
| * themis_config_cache_size - gauge | ||
| * themis_config_cache_capacity - gauge (info) | ||
| * themis_config_cache_ttl_seconds - gauge (info) |
makr-code
approved these changes
Mar 14, 2026
Owner
|
@copilot Kommentare umsetzten. |
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
[WIP] [HIGH-PRIORITY] Implement Prometheus metrics exporter for path resolution
[HIGH-PRIORITY] Harden Prometheus metrics exporter for path resolution
Mar 14, 2026
Owner
|
@copilot apply changes based on the comments in this thread |
Copilot stopped work on behalf of
makr-code due to an error
March 14, 2026 17:24
Copilot stopped work on behalf of
makr-code due to an error
March 14, 2026 18:25
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copilot
AI
changed the title
[HIGH-PRIORITY] Harden Prometheus metrics exporter for path resolution
Correct retry attempt statistics for TransactionRetryManager
Mar 14, 2026
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.
The retry metrics were overstating retry attempts when a terminal failure occurred, skewing observability for TransactionRetryManager. This change ensures
total_retry_attemptsonly increments when another attempt will run, and adds a regression test to lock in the behavior.Description
total_retry_attemptsincrementation so it only occurs when a further retry is scheduled, preventing overcount on terminal failures.total_retry_attemptsreflects the actual number of retries (initial attempt excluded).Type of Change
Testing
📚 Research & Knowledge (wenn applicable)
/docs/research/angelegt?/docs/research/implementation_influence/eingetragen?Relevante Quellen:
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.