Documentation
¶
Index ¶
- Variables
- func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler) http.HandlerFunc
- func InstrumentHandlerDuration(histogram *prometheus.HistogramVec, next http.Handler) http.HandlerFunc
- type ApplicationServer
- type BaseServer
- type Handler
- type Metrics
- type Prometheus
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefBuckets = []float64{.001, .01, .1, 1, 10}
)
Functions ¶
func InstrumentHandlerCounter ¶
func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler) http.HandlerFunc
func InstrumentHandlerDuration ¶
func InstrumentHandlerDuration(histogram *prometheus.HistogramVec, next http.Handler) http.HandlerFunc
Types ¶
type ApplicationServer ¶
type ApplicationServer struct {
Handlers []Handler
BaseServer
}
ApplicationServer contains the configuration items for an HTTP Server
type BaseServer ¶
type BaseServer struct {
Port int
// contains filtered or unexported fields
}
func (*BaseServer) GetPort ¶
func (b *BaseServer) GetPort() int
func (*BaseServer) Run ¶
func (b *BaseServer) Run() (err error)
Run starts the HTTP Server. This calls server's http.Server's Serve method and returns that method's return value.
type Handler ¶
type Handler struct {
// Path of the endpoint (e.g. "/health"). Must include the leading /
Path string
// Handler that implements the endpoint
Handler http.Handler
// Methods that the handler should support. If empty, http.MethodGet is the default
Methods []string
}
Handler contains an endpoint to be registered in the Server's HTTP server, using NewWithHandlers.
type Metrics ¶
type Metrics struct {
RequestCounter *prometheus.CounterVec
DurationHistogram *prometheus.HistogramVec
}
Metrics contains the metrics that need to be captured while serving HTTP requests. If these are not provided then Server will create default metrics and register them with Prometheus' default registry.
type Prometheus ¶
type Prometheus struct {
Path string
BaseServer
}
Prometheus contains the different Prometheus configuration options
type Server ¶
type Server struct {
Name string
ApplicationServer
Prometheus
Metrics
}
Click to show internal directories.
Click to hide internal directories.