Documentation ¶
Index ¶
Constants ¶
View Source
const (
MetricsPrometheusPath = "/metrics/prometheus"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
Handler handles HTTP requests to health and version endpoints.
func NewHandler ¶
NewHandler instantiates a handler.
func (*Handler) Metrics ¶
func (h *Handler) Metrics(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
Metrics outputs prometheus metrics
swagger:route GET /metrics/prometheus metadata prometheus
Get snapshot metrics from the service. If you're using k8s, you can then add annotations to your deployment like so:
``` metadata:
annotations: prometheus.io/port: "4434" prometheus.io/path: "/metrics/prometheus"
```
Produces: - plain/text Responses: 200: emptyResponse
func (*Handler) SetRoutes ¶
func (h *Handler) SetRoutes(r *httprouter.Router)
SetRoutes registers this handler's routes.
type Metrics ¶
type Metrics struct {
ResponseTime *prometheus.HistogramVec
}
Metrics prototypes
func NewMetrics ¶
Method for creation new custom Prometheus metrics
type MetricsManager ¶
type MetricsManager struct {
// contains filtered or unexported fields
}
func NewMetricsManager ¶
func NewMetricsManager(app, version, hash, buildTime string) *MetricsManager
func (*MetricsManager) RegisterRouter ¶
func (pmm *MetricsManager) RegisterRouter(router *httprouter.Router)
func (*MetricsManager) ServeHTTP ¶
func (pmm *MetricsManager) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Main middleware method to collect metrics for Prometheus.
Click to show internal directories.
Click to hide internal directories.