prometheus

package
v0.0.257 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 7 Imported by: 16

Documentation

Index

Constants

View Source
const (
	MetricsPrometheusPath = "/metrics/prometheus"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	H             herodot.Writer
	VersionString string
}

Handler handles HTTP requests to health and version endpoints.

func NewHandler

func NewHandler(
	h herodot.Writer,
	version string,
) *Handler

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 admin 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

func NewMetrics(app, version, hash, date string) *Metrics

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL