metrics

package
v0.0.0-...-1185af5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package metrics provides a wrapper around of metrics for grpc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(metrics *Server)

Option sets up a metrics server.

func WithAddrAssigned

func WithAddrAssigned() Option

WithAddrAssigned sets service to ask for listener assigned address. Mainly used when the port to the listener is assigned dynamically.

func WithAddress

func WithAddress(addr string) Option

WithAddress sets metrics server address.

func WithListener

func WithListener(l net.Listener, shouldCloseListener bool) Option

WithListener sets the listener. Metrics server does not need to start a new one.

func WithPort

func WithPort(port int) Option

WithPort sets metrics server address port.

type Server

type Server struct {
	AddrAssigned chan string
	// contains filtered or unexported fields
}

Server is a wrapper around http.Server for a metrics.

func NewMetricsService

func NewMetricsService(
	_ context.Context,
	listener net.Listener,
) *Server

NewMetricsService creates an instance of metrics service.

func NewServer

func NewServer(opts ...Option) *Server

NewServer initiates a new metrics server.

func (*Server) Addr

func (s *Server) Addr() string

Addr service address.

func (*Server) Listener

func (s *Server) Listener() net.Listener

Listener returns the listener.

func (*Server) Name

func (s *Server) Name() string

Name Service name.

func (*Server) ServerMetrics

func (s *Server) ServerMetrics() *grpcPrometheus.ServerMetrics

ServerMetrics returns the grpc server metrics.

func (*Server) Start

func (s *Server) Start() error

Start begins listening and serving.

func (*Server) WithShutdownSignal

func (s *Server) WithShutdownSignal(shutdown <-chan struct{}, done chan<- struct{}) servicing.Service

WithShutdownSignal adds channels to wait for shutdown and to report shutdown finished.

Jump to

Keyboard shortcuts

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