srvgrpc

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Trace = otgrpc.OpenTracingServerInterceptor

Trace is an alias of otgrpc.OpenTracingServerInterceptor. It is recommended to use the trace implementation in github.com/opentracing-contrib/go-grpc. This alias serves as a pointer to it.

Functions

func Metrics added in v0.9.0

Metrics is a unary interceptor for grpc package. It records the request duration in a histogram.

Types

type HealthCheckModule

type HealthCheckModule struct{}

HealthCheckModule defines a grpc provider for container.Container.

func (HealthCheckModule) ProvideGRPC

func (h HealthCheckModule) ProvideGRPC(server *grpc.Server)

ProvideGRPC implements container.GRPCProvider

type MetricsModule

type MetricsModule struct{}

MetricsModule exposes prometheus metrics. Here only provides a simple call, more complex use, please refer to github.com/grpc-ecosystem/go-grpc-prometheus.

Need to actively provide grpc.Server:

opts := []grpc.ServerOption{
	grpc.UnaryInterceptor(grpc_prometheus.UnaryServerInterceptor),
	grpc.StreamInterceptor(grpc_prometheus.StreamServerInterceptor),
}
server = grpc.NewServer(opts...)

func (MetricsModule) ProvideGRPC

func (m MetricsModule) ProvideGRPC(server *grpc.Server)

ProvideGRPC implements container.GRPCProvider

type RequestDurationSeconds added in v0.9.0

type RequestDurationSeconds struct {
	// Histogram is the underlying histogram of RequestDurationSeconds.
	Histogram metrics.Histogram
	// contains filtered or unexported fields
}

RequestDurationSeconds is a Histogram that measures the request latency.

func (*RequestDurationSeconds) Module added in v0.9.0

Module specifies the module label for RequestDurationSeconds.

func (RequestDurationSeconds) Observe added in v0.9.0

func (r RequestDurationSeconds) Observe(seconds float64)

Observe records the time taken to process the request.

func (*RequestDurationSeconds) Route added in v0.9.0

Route specifies the method label for RequestDurationSeconds.

func (*RequestDurationSeconds) Service added in v0.9.0

Service specifies the service label for RequestDurationSeconds.

Jump to

Keyboard shortcuts

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