Table of Contents

Metrics

Description

Prometheus-based metrics with a built-in pie chart UI. Increment counters anywhere in your code and view them as charts at a dedicated endpoint — no external tools required.

Features

  • Metric.Inc(label, segment): increment a counter from anywhere in code
  • Built-in UI: pie charts rendered at /metrics/ui
  • Multi-node support: UI fetches metrics from all running instances simultaneously
  • Auto-coloring: segment names like error, success, timeout get meaningful colors automatically
  • Custom colors and ordering: configure per-metric via MetricCharts

Behavior

Two endpoints are registered automatically when metrics are enabled:

/metrics     → raw Prometheus text format
/metrics/ui  → pie chart dashboard (Pro Tier)

UI is cached for 20 seconds — refreshes automatically on next request after expiry.

Multi-node fetching makes 7 parallel requests to the metrics endpoint — aggregates results across load balanced instances.

Auto-color mapping based on segment name:

error, fail, crash, 500, 502    → red
success, hit, ok, 200, 201      → green
warn, notfound, 404             → orange
timeout, unauthorized, 401      → light red
circuit, broken, 503            → dark red

Caveats

  • Metrics UI requires Pro Tier license
  • Metric.Inc() is a no-op if metrics are disabled — zero overhead
  • Multi-node fetching assumes all instances are reachable on the same host/port — configure metricUIUrl in appsettings if behind a proxy
  • Default Prometheus metrics are suppressed — only framework and consumer metrics are shown
Tip

Use label for the category and segment for the outcome:

Metric.Inc("checkout", "success");
Metric.Inc("checkout", "timeout");
Metric.Inc("cache", "hit");
Metric.Inc("cache","miss");

Most common segments are auto-colored — success is green, timeout is red, no configuration needed.

AppSettings

View all appsettings here