MetricsController class

Exposes GET /metrics in Prometheus text format (0.0.4).

Register it via app.enableMetrics() (called after addControllers).

The endpoint returns Content-Type: text/plain; version=0.0.4; charset=utf-8 so Prometheus can scrape it without any extra configuration.

Metrics exposed:

  • http_requests_total{method,path,status} — request counter
  • http_request_duration_seconds{method,path} — latency histogram
Inheritance

Constructors

MetricsController()

Properties

hashCode int
The hash code for this object.
no setterinherited
routes List<ApiRoute>
HTTP routes exposed by this controller.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tag String?
Default OpenAPI tag applied to all routes that declare no explicit tags.
no setterinherited
webSocketRoutes List<WebSocketRoute>
WebSocket routes exposed by this controller.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited