metricsservice

package
v0.20.7 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadConfigStatPrefix = "read_config"
	PrometheusStatPrefix = "prometheus"

	ServerUptime = "server.uptime"

	TcpStatPrefix      = "tcp"
	HttpStatPrefix     = "http"
	ListenerStatPrefix = "listener"
)

Variables

This section is empty.

Functions

func NewConfigMapBackedDefaultHandler

func NewConfigMapBackedDefaultHandler(ctx context.Context) (*metricsHandler, error)

get the default metrics handler backed by a config map

func NewConfigMapStorage

func NewConfigMapStorage(podNamespace string, configMapClient k8s.ConfigMapInterface) *configMapStorageClient

func NewDefaultConfigMapStorage

func NewDefaultConfigMapStorage(podNamespace string) (*configMapStorageClient, error)

func NewDefaultMetricsHandler

func NewDefaultMetricsHandler(storage StorageClient, merger *UsageMerger) *metricsHandler

Types

type CurrentTimeProvider

type CurrentTimeProvider func() time.Time

type EnvoyMetrics

type EnvoyMetrics struct {
	HttpRequests   uint64
	TcpConnections uint64
	Uptime         time.Duration
}

type EnvoyUsage

type EnvoyUsage struct {
	EnvoyMetrics    *EnvoyMetrics
	LastRecordedAt  time.Time
	FirstRecordedAt time.Time
	Active          bool // whether or not we believe this envoy to be active
}

type GlobalUsage

type GlobalUsage struct {
	EnvoyIdToUsage map[string]*EnvoyUsage
}

type MetricsHandler

type MetricsHandler interface {
	HandleMetrics(context.Context, *envoymet.StreamMetricsMessage) error
}

type Options

type Options struct {
	Ctx context.Context
}

type Server

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

server is used to implement envoymet.MetricsServiceServer.

func NewServer

func NewServer(opts Options, handler MetricsHandler) *Server

func (*Server) StreamMetrics

func (s *Server) StreamMetrics(envoyMetrics envoymet.MetricsService_StreamMetricsServer) error

type StorageClient

type StorageClient interface {
	RecordUsage(ctx context.Context, usage *GlobalUsage) error
	GetUsage(ctx context.Context) (*GlobalUsage, error)
}

type UsageMerger

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

func NewUsageMerger

func NewUsageMerger(currentTimeProvider CurrentTimeProvider) *UsageMerger

provide a way to get the current time used to make unit tests easier to write and more deterministic

func (*UsageMerger) MergeUsage

func (u *UsageMerger) MergeUsage(envoyInstanceId string, oldUsage *GlobalUsage, newMetrics *EnvoyMetrics) *GlobalUsage

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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