veneur: github.com/stripe/veneur/proxysrv Index | Files

package proxysrv

import "github.com/stripe/veneur/proxysrv"

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

Package Files

client_conn_map.go options.go server.go

type Option Uses

type Option func(*options)

Option modifies an internal options type.

func WithForwardTimeout Uses

func WithForwardTimeout(d time.Duration) Option

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

func WithLog Uses

func WithLog(e *logrus.Entry) Option

WithLog sets the logger entry used in the object.

func WithStatsInterval Uses

func WithStatsInterval(d time.Duration) Option

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

func WithTraceClient Uses

func WithTraceClient(c *trace.Client) Option

WithTraceClient sets the trace client used by the server.

type Server Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (s *Server) Stop()

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

Package proxysrv imports 18 packages (graph) and is imported by 1 packages. Updated 2020-02-04. Refresh now. Tools for package owners.