Add the five Ledgerline application metrics
- ledgerline.transactions.total (counter: kind, status, currency) and ledgerline.transaction.duration (histogram, seconds: kind) in gateway, the only place that sees the final outcome, failures included. currency is client input, so values outside the seeded set are recorded as "other". - ledgerline.fraud.score (histogram, buckets in 0.1 steps to 1.0) in fraud. - ledgerline.stream.lag (observable gauge: consumer_group) in audit and notifier, read from XINFO GROUPS through a separate sync Redis client, because callbacks run on the scrape thread; the call is untraced so scrapes don't create traces. - ledgerline.db.pool.in_use (observable up-down counter: pool) in every service with a DB engine. The SQLAlchemy instrumentation's own pool metric names a pool by DSN, which merges the normal and starved engines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7cb3231226
commit
920712f32b
@@ -11,6 +11,7 @@ from opentelemetry.trace import StatusCode
|
||||
|
||||
from common.chaos_flags import flags_fingerprint
|
||||
from common.logging_config import configure_logging
|
||||
from common.metrics import observe_db_pools
|
||||
from common.redis_client import redis_client
|
||||
from common.settings import settings
|
||||
from common.telemetry import setup_telemetry
|
||||
@@ -34,6 +35,7 @@ FastAPIInstrumentor.instrument_app(
|
||||
SQLAlchemyInstrumentor().instrument(
|
||||
engines=[normal_engine.sync_engine, starved_engine.sync_engine]
|
||||
)
|
||||
observe_db_pools({"normal": normal_engine, "starved": starved_engine})
|
||||
|
||||
# Cache-stampede protection for the Redis-cached branch below: a burst of
|
||||
# concurrent requests for the same not-yet-cached (account, flags) key would
|
||||
|
||||
Reference in New Issue
Block a user