types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DBMetrics = promauto.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "connections",
			Subsystem: "sql",
			Name:      "call_duration_seconds",
			Help:      "query duration seconds",
			Buckets:   []float64{.005, .01, .025, .05, .075, .1, .15, .2, .25, .5, 1, 2.5},
		}, []string{"query", "service", "error"},
	)

	GRPCErrorMetrics = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: "grpc",
		Name:      "error_total",
		Help:      "Number of grpc errors.",
	})

	GRPCPanicMetrics = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: "grpc",
		Name:      "panic_total",
		Help:      "Number of grpc panic.",
	})
)

Functions

func GRPCErrorInc

func GRPCErrorInc()

func GRPCPanicInc

func GRPCPanicInc()

func StartServerWithWaiting

func StartServerWithWaiting(ctx context.Context, f func(errCh chan error)) error

func WithSQLMetrics

func WithSQLMetrics(
	queryName, serviceName string,
	callFunc func() error,
) error

Types

type App

type App interface {
	Run(context.Context) error
}

type Module

type Module []Provider

func (Module) Append

func (m Module) Append(o Module) Module

type Provider

type Provider struct {
	CreateFunc interface{}
	Options    []dig.ProvideOption
}

type Runnable

type Runnable interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
}

type ServerList

type ServerList []Runnable

type ServerPool

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

func NewServerPool

func NewServerPool(sl ServerList, logger *zap.Logger) *ServerPool

func (*ServerPool) Start

func (p *ServerPool) Start(ctx context.Context) error

func (*ServerPool) Stop

func (p *ServerPool) Stop(ctx context.Context)

type ServiceList

type ServiceList []Runnable

type ServicePool

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

func NewServicePool

func NewServicePool(sl ServiceList, logger *zap.Logger) *ServicePool

func (*ServicePool) Start

func (p *ServicePool) Start(ctx context.Context) error

func (*ServicePool) Stop

func (p *ServicePool) Stop(ctx context.Context)

Jump to

Keyboard shortcuts

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