proxysrv

package
v13.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: MIT Imports: 18 Imported by: 5

Documentation

Overview

Package proxysrv proxies metrics over gRPC to global veneurs using consistent hashing

The Server provided accepts a hash ring of destinations, and then listens for metrics over gRPC. It hashes each metric to a specific destination, and forwards each metric to its appropriate destination Veneur.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option modifies an internal options type.

func WithForwardTimeout

func WithForwardTimeout(d time.Duration) Option

WithForwardTimeout sets the time after which an individual RPC to a downstream Veneur times out

func WithLog

func WithLog(e *logrus.Entry) Option

WithLog sets the logger entry used in the object.

func WithStatsInterval

func WithStatsInterval(d time.Duration) Option

WithStatsInterval sets the time interval at which diagnostic metrics about the server will be emitted.

func WithTraceClient

func WithTraceClient(c *trace.Client) Option

WithTraceClient sets the trace client used by the server.

type Server

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

Server is a gRPC server that implements the forwardrpc.Forward service. It receives metrics and forwards them consistently to a destination, based on the metric name, type and tags.

func New

func New(destinations *consistent.Consistent, opts ...Option) (*Server, error)

New creates a new Server with the provided destinations. The server returned is unstarted.

func (*Server) SendMetrics

func (s *Server) SendMetrics(ctx context.Context, mlist *forwardrpc.MetricList) (*empty.Empty, error)

SendMetrics spawns a new goroutine that forwards metrics to the destinations and exist immediately.

func (*Server) Serve

func (s *Server) Serve(addr string) error

Serve starts a gRPC listener on the specified address and blocks while listening for requests. If listening is interrupted by some means other than Stop or GracefulStop being called, it returns a non-nil error.

func (*Server) SetDestinations

func (s *Server) SetDestinations(dests *consistent.Consistent) error

SetDestinations updates the ring of hosts that are forwarded to by the server. If new hosts are being added, a gRPC connection is initialized for each.

This also prunes the list of open connections. If a connection exists to a host that wasn't in either the current list or the last one, the connection is closed.

func (*Server) Stop

func (s *Server) Stop()

Stop stops the gRPC server (if it was started) and closes all gRPC client connections.

Jump to

Keyboard shortcuts

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