metric

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolHTTP represents protocol name for HTTP requests.
	ProtocolHTTP = "http"

	// ProtocolGRPC represents protocol name for gRPC requests.
	ProtocolGRPC = "grpc"
)

Variables

This section is empty.

Functions

func NewRequestDuration

func NewRequestDuration() *prometheus.HistogramVec

NewRequestDuration configures and returns a new request_duration_seconds histogram.

Types

type Recorder

type Recorder interface {
	RequestDuration() *prometheus.HistogramVec
	HTTPHandler() http.Handler
}

Recorder represents application metrics recorder.

func NewRecorder

func NewRecorder() (Recorder, error)

NewRecorder registers all metrics and returns a new metric recorder. nolint: exhaustivestruct

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements HTTP metric server.

func NewServer

func NewServer(log *zerolog.Logger, metricCfg config.MetricsConfig, mrec Recorder) (*Server, error)

NewServer configures a new Server.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve start HTTP server to serve requests.

Jump to

Keyboard shortcuts

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