types

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 12 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"},
	)

	DBErrorMetrics = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: "connections",
		Subsystem: "sql",
		Name:      "error_total",
		Help:      "Number of db errors.",
	}, []string{"query_name"})

	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.",
	})

	KafkaConsumerGroupMetrics = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "kafka",
			Subsystem: "consumer_group",
			Name:      "duration_consume",
			Help:      "Consumer group consume duration",
		},
		[]string{"consumer_group", "topic", "error"},
	)

	KafkaSyncProducerMetrics = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "kafka",
			Subsystem: "sync_producer",
			Name:      "produce_count",
			Help:      "Sync producer produce count",
		},
		[]string{"topic", "error"},
	)
)

Functions

func CheckAddr added in v1.0.8

func CheckAddr(addr string) string

func GRPCErrorInc

func GRPCErrorInc()

func GRPCPanicInc

func GRPCPanicInc()

func KafkaConsumerGroupMetricsF added in v1.0.9

func KafkaConsumerGroupMetricsF(groupName, topic string, err error, duration float64)

func KafkaSyncProducerMetricsF added in v1.0.9

func KafkaSyncProducerMetricsF(topic string, err error)

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 any
	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