fix: validate exporter counter ranges#3948
Open
pinehill99 wants to merge 3 commits into
Open
Conversation
Initial web commit for orchestration-agent#3846 exporter snapshot range validation; remaining files will be added before opening the PR.
Part of orchestration-agent#3846 exporter counter range fix.
Part of orchestration-agent#3846 exporter counter range fix.
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.
Fixes #3846
Summary
MetricsCollector.snapshot(max_counter_value=...)validation for exporter-facing counter range limitsOverflowErrorwith the metric name before an exporter snapshot can expose an out-of-range counterRLockso timer snapshot tests do not deadlock whenstop_timer()records an observationAgentStatussymbol so the repository's current full test suite collectsScope and overlap
The issue asks for optional max counter validation for exporter mode. This implementation keeps the limit at the snapshot/export boundary instead of rejecting or capping normal in-memory increments, which preserves existing collector behavior while protecting exporter-facing snapshots.
Current overlap checked on 2026-05-25 KST: issue #3846 is open and has two matching open PRs, #3847 and #3878. #3847 appears to use a constructor/increment-time
max_counter_valuestyle guard; #3878 caps counters and exposes max metadata. This PR intentionally competes with a snapshot/export-boundary implementation.Validation
python3 -m pytest tests/test_metrics.py::TestMetricsCollector::test_snapshot_rejects_counter_above_export_limit -qfailed before implementation withTypeError: MetricsCollector.snapshot() got an unexpected keyword argument 'max_counter_value'python3 -m pytest tests/test_metrics.py -q-> 6 passedpython3 -m pytest tests/test_metrics.py tests/test_config.py tests/test_agent_registry.py -q-> 19 passedpython3 -m pytest tests -q-> 24 passeduv run flake8 src/agent/__init__.py src/common/metrics.py tests/test_metrics.py-> passed with pyproject dev-dependencies deprecation warning onlypython3 -m py_compile src/agent/__init__.py src/common/metrics.py tests/test_metrics.py-> passedgit diff --check-> passedRisk control