feat: v4 — domain Prometheus metrics + operations/scaling docs#63
Merged
Conversation
Roadmap v4 — completes the observability story: - X1: DomainMetricsCollector exposes trading-domain gauges on /metrics (criptotrade_open_positions, _total_trades, _realized_pnl_usdt, _win_rate, _sharpe_ratio, _portfolio_value_usdt). It reads the shared ledger on scrape, so the numbers are correct even though the orchestrator runs in a separate process from the API (process-local counters could not do this). Fail-safe. - X2: README "Observabilidade & Escala" section (probes, /metrics, JSON logs, X-Request-ID, Redis scale-out, ADR-005). Full suite: 406 passing, ruff clean, coverage 72.89%. Tracking: docs/roadmap_v4.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014htKJbgi3z1m3kzDVwXwfS
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.
Resumo
v4 — fecha a história de observabilidade: além de métricas HTTP, expõe métricas de negócio no
/metricse documenta operação & escala. Tracker:docs/roadmap_v4.md.O que muda
DomainMetricsCollectorexpõe gauges de negócio no/metrics:criptotrade_open_positions,_total_trades,_realized_pnl_usdt,_win_rate,_sharpe_ratio,_portfolio_value_usdt.Lê o ledger compartilhado no momento do scrape → correto mesmo com o orchestrator em outro processo (contadores locais ao processo do API não conseguiriam). Fail-safe (nunca quebra o scrape).
/health,/health/ready,/metrics), logs JSON,X-Request-ID, scale-out via Redis, ADR-005.Por que importa
Métricas de domínio são o que torna o Prometheus útil para um app de trading (não só latência HTTP) — e a abordagem por collector é a única correta dado o desenho cross-process.
Testes
tests/api/test_observability.py.Encerra o arco autônomo v1→v4 (app de produção, em Docker, pronto para escalar). O restante é gated por infra/decisão do dono ou pelos gatilhos do ADR-005.
🤖 Generated with Claude Code
https://claude.ai/code/session_014htKJbgi3z1m3kzDVwXwfS
Generated by Claude Code