Skip to content

[metrics] profit_usd_cents histogram uses default Prometheus buckets — useless for Venus profit range #217

@obchain

Description

@obchain

Refs #50

File: crates/charon-metrics/src/lib.rs

Problem

charon_executor_profit_usd_cents is a histogram. Default Prometheus buckets target HTTP latency (0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10 seconds). Venus liquidation profit ranges from /tmp/pr50-cmds.sh.05 to 000+ per opportunity. With cents as unit (5 to 500000), every observation falls into the +Inf bucket. histogram_quantile returns NaN. The Grafana dashboard (PR #54) renders empty charts.

Fix

Define buckets covering realistic profit range:

const PROFIT_CENTS_BUCKETS: &[f64] = &[
    5.0,      // /tmp/pr50-cmds.sh.05 — dust
    50.0,     // /tmp/pr50-cmds.sh.50
    500.0,    // 
    2_500.0,  // 5
    10_000.0, // 00
    50_000.0, // 00
    250_000.0,// 500
    1_000_000.0, // 0k
];

Pass to histogram registration. Same for block_duration_seconds (sibling issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayer:rustRust crates (core / scanner / protocols / executor / cli)pr-reviewFindings from PR review processpriority:p1-coreCore MVP scopestatus:readyScoped and ready to pick up

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions