func ID(prefix string) echo.MiddlewareFunc {
	gen := newID(prefix)
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) error {
			id := c.Request().Header.Get(echo.HeaderXRequestID)
			if id == "" {
				var err error
				id, err = gen.generate()
				if err != nil {
					return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to generate request ID: %s", err))
				}
			}
			c.Request().Header.Set(echo.HeaderXRequestID, id)
			c.Request().Header.Set("Grpc-Metadata-Request-ID", id)
			c.Response().Header().Set(echo.HeaderXRequestID, id)
			return next(c)
		}
	}
}
ID adds a request id to the request.
package middleware
import (
	"crypto/rand"
	"fmt"
	"net/http"
	"time"
	echo "github.com/labstack/echo/v4"
	ulid "github.com/oklog/ulid/v2"
)
var now = time.Now