Echo Prometheus metrics and monitoring middleware

March 1, 2026 ยท View on GitHub

Sourcegraph GoDoc Go Report Card License

Echo Prometheus metrics and monitoring middleware

Prometheus middleware for Echo framework.

Versioning

  • version v0.x.y tracks the latest Echo version (v5).
  • main branch is compatible with the latest Echo version (v5).

Usage

Add Prometheus middleware dependency

go get github.com/labstack/echo-prometheus

Use as an import statement

import echoprometheus "github.com/labstack/echo-prometheus"

Add middleware to your Echo instance

e.Use(echoprometheus.NewMiddleware("myapp"))

or with config

e.Use(echoprometheus.NewMiddlewareWithConfig(echoprometheus.MiddlewareConfig{
    Subsystem: "myapp",
}))

Add handler to your Echo instance to expose metrics

e.GET("/metrics", echoprometheus.NewHandler())

Full example

See example