Skip to content

Add V2Fly v5 metrics collection and direct MU Server reporting - #9

Merged
orvice merged 2 commits into
mainfrom
codex/v2fly-prometheus-metrics
Nov 22, 2026
Merged

orvice merged 2 commits into
mainfrom
codex/v2fly-prometheus-metrics

Conversation

@orvice

@orvice orvice commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

V2Fly v5 StatsService
  read one snapshot per unique VMess or VLESS backend address
  export through either opt-in path
    /metrics for Prometheus
    NodeMetricsService.ReportNodeMetrics for MU Server

Snapshots include backend health, runtime stats, and cumulative traffic by proxy tag. The collector reads counters without clearing them and excludes user identities.

Set MU_NODE_METRICS_REPORTING_ENABLED=true for a report at startup and every minute. Set MU_METRICS_ENABLED=false for push-only operation. A transient report failure gets one retry with the same batch ID. Prometheus V2Fly collection uses MU_V2FLY_METRICS_ENABLED=true.

Evidence

  • Before MU exposed service and synchronization metrics on /metrics.
  • After TestV2FlyMetricsEndpoint covers Prometheus collection. TestReportNodeMetricsWithoutPrometheus covers authenticated Twirp reporting with Prometheus disabled, stable batches on retry, shared backend addresses, and continued reporting when a backend fails.
  • go test -race ./..., golangci-lint run, and golangci-lint fmt --diff passed.

Merge Danger

Door Two-way. Both V2Fly metric delivery options default to off.

Blast Radius Monitoring. Before enabling direct reporting, deploy the MU Server handler at /v1.NodeMetricsService/ with token-to-node authorization and idempotent storage keyed by (node_id, batch_id). Reports are held in memory through the retry and can be lost during a prolonged outage.

@orvice orvice changed the title Expose V2Fly v5 backend metrics in Prometheus Add V2Fly v5 metrics collection and direct MU Server reporting Nov 21, 2026
@orvice
orvice merged commit 270a072 into main Nov 22, 2026
3 checks passed
@orvice
orvice deleted the codex/v2fly-prometheus-metrics branch November 22, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant