metrics

package
v0.0.0-...-f77605d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MulanPSL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "build_info",
		Help: "Build information",
	}, []string{"version", "commit", "date"})

	Up = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "up",
		Help: "service up",
	}, []string{"service"})
)

Functions

func ErrorHandler

func ErrorHandler(_ context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, writer http.ResponseWriter, request *http.Request, err error)

func InitMetrics

func InitMetrics(name, version, gitCommit, BuildTs string)

Types

type MetricsServer

type MetricsServer = Server

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

func NewMetricsServer

func NewMetricsServer() *Server

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) Start

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

func (*Server) Stop

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

Stop the HTTP server.

type ServerOption

type ServerOption func(*Server)

ServerOption is an HTTP server option.

func Address

func Address(addr string) ServerOption

Address with server address.

func Gatherer

func Gatherer(gatherer prometheus.Gatherer) ServerOption

func Path

func Path(path string) ServerOption

Jump to

Keyboard shortcuts

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