metrics

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 13

Documentation

Index

Constants

View Source
const (
	DownstreamConnectionTotal    = "connection_total"
	DownstreamConnectionDestroy  = "connection_destroy"
	DownstreamConnectionActive   = "connection_active"
	DownstreamBytesReadTotal     = "bytes_read_total"
	DownstreamBytesReadBuffered  = "bytes_read_buffered"
	DownstreamBytesWriteTotal    = "bytes_write_total"
	DownstreamBytesWriteBuffered = "bytes_write_buffered"
	DownstreamRequestTotal       = "request_total"
	DownstreamRequestActive      = "request_active"
	DownstreamRequestReset       = "request_reset"
	DownstreamRequestTime        = "request_time"
	DownstreamRequestTimeTotal   = "request_time_total"
	DownstreamProcessTime        = "process_time"
	DownstreamProcessTimeTotal   = "process_time_total"
	DownstreamRequestFailed      = "request_failed"
	DownstreamRequest200Total    = "request_200_total"
	DownstreamRequest206Total    = "request_206_total"
	DownstreamRequest302Total    = "request_302_total"
	DownstreamRequest304Total    = "request_304_total"
	DownstreamRequest400Total    = "request_400_total"
	DownstreamRequest403Total    = "request_403_total"
	DownstreamRequest404Total    = "request_404_total"
	DownstreamRequest416Total    = "request_416_total"
	DownstreamRequest499Total    = "request_499_total"
	DownstreamRequest500Total    = "request_500_total"
	DownstreamRequest502Total    = "request_502_total"
	DownstreamRequest503Total    = "request_503_total"
	DownstreamRequest504Total    = "request_504_total"
	DownstreamRequestOtherTotal  = "request_other_code"
)

metrics key in listener/proxy

View Source
const (
	HealthCheckAttempt        = "attempt"
	HealthCheckSuccess        = "success"
	HealthCheckFailure        = "failure"
	HealthCheckActiveFailure  = "active_failure"
	HealthCheckPassiveFailure = "passive_failure"
	HealthCheckNetworkFailure = "network_failure"
	HealthCheckVeirfyCluster  = "verify_cluster"
	HealthCheckHealthy        = "healty"
)

health check metrics key

View Source
const (
	GoVersion    = "go_version:"
	Version      = "version:"
	ListenerAddr = "listener_address:"
	StateCode    = "mosn_state_code"
)

mosn basic info metrics

View Source
const (
	UpstreamConnectionTotal                        = "connection_total"
	UpstreamConnectionClose                        = "connection_close"
	UpstreamConnectionActive                       = "connection_active"
	UpstreamConnectionConFail                      = "connection_con_fail"
	UpstreamConnectionRetry                        = "connection_retry"
	UpstreamConnectionLocalClose                   = "connection_local_close"
	UpstreamConnectionRemoteClose                  = "connection_remote_close"
	UpstreamConnectionLocalCloseWithActiveRequest  = "connection_local_close_with_active_request"
	UpstreamConnectionRemoteCloseWithActiveRequest = "connection_remote_close_with_active_request"
	UpstreamConnectionCloseNotify                  = "connection_close_notify"
	UpstreamRequestTotal                           = "request_total"
	UpstreamRequestActive                          = "request_active"
	UpstreamRequestLocalReset                      = "request_local_reset"
	UpstreamRequestRemoteReset                     = "request_remote_reset"
	UpstreamRequestTimeout                         = "request_timeout"
	UpstreamRequestFailureEject                    = "request_failure_eject"
	UpstreamRequestPendingOverflow                 = "request_pending_overflow"
	UpstreamRequestDuration                        = "request_duration_time"
	UpstreamRequestDurationEWMA                    = "request_duration_time_ewma"
	UpstreamRequestDurationTotal                   = "request_duration_time_total"
	UpstreamResponseSuccess                        = "response_success"
	UpstreamResponseFailed                         = "response_failed"
	UpstreamResponseTotalEWMA                      = "response_total_ewma"
	UpstreamResponseClientErrorEWMA                = "response_client_error_ewma"
	UpstreamResponseServerErrorEWMA                = "response_server_error_ewma"
)

key in cluster/host

View Source
const (
	UpstreamRequestRetry         = "request_retry"
	UpstreamRequestRetryOverflow = "request_retry_overflow"
	UpstreamLBSubSetsFallBack    = "lb_subsets_fallback"
	UpstreamLBSubsetsCreated     = "lb_subsets_created"
	UpstreamBytesReadTotal       = "connection_bytes_read_total"
	UpstreamBytesReadBuffered    = "connection_bytes_read_buffered"
	UpstreamBytesWriteTotal      = "connection_bytes_write"
	UpstreamBytesWriteBuffered   = "connection_bytes_write_buffered"
)

key in cluster

View Source
const DownstreamType = "downstream"

DownstreamType represents downstream metrics type

View Source
const HealthCheckType = "healthcheck"

HealthCheckType represents health check metrics type

View Source
const MaxLabelCount = 20
View Source
const MosnMetaType = "meta"

MosnMetaType represents mosn basic metrics type

View Source
const (
	TLSConnpoolChanged = "connpool_changed"
)

tls metrics key

View Source
const TLSType = "mosn_tls"

TLSType represents tls metrics type

View Source
const UpstreamType = "upstream"

UpstreamType represents upstream metrics type

Variables

View Source
var (
	// FlushMosnMetrics marks output mosn information metrics or not, default is false
	FlushMosnMetrics bool

	// LazyFlushMetrics marks flush data with lazy mode
	LazyFlushMetrics bool
)
View Source
var (
	ErrLazyCounterCtorEmpty   = errors.New("build lazy Counter ctor is empty")
	ErrLazyGaugeCtorEmpty     = errors.New("build lazy Gauge ctor is empty")
	ErrLazyHistogramCtorEmpty = errors.New("build lazy Histogram ctor is empty")
	ErrLazyEWMACtorEmpty      = errors.New("build lazy EWMA ctor is empty")
)
View Source
var (
	ErrLabelCountExceeded = fmt.Errorf("label count exceeded, max is %d", MaxLabelCount)
)

Functions

func AddListenerAddr

func AddListenerAddr(addr string)

AddListenerAddr adds a listener addr info

func GetAll

func GetAll() (metrics []types.Metrics)

GetAll returns all metrics data

func GetMetricsFilter added in v0.18.0

func GetMetricsFilter(filter string) (metrics types.Metrics)

filter is type.labels see example in `GetProxyTotal`

func GetProxyTotal added in v0.14.0

func GetProxyTotal() (metrics types.Metrics)

GetProxyTotal returns proxy global metrics data

func NewClusterStats

func NewClusterStats(clusterName string) types.Metrics

NewClusterStats returns a stats with namespace prefix cluster

func NewHealthStats

func NewHealthStats(serviceName string) types.Metrics

NewHealthStats returns a stats with namespace prefix service

func NewHostStats

func NewHostStats(clusterName string, addr string) types.Metrics

NewHostStats returns a stats that namespace contains cluster and host address

func NewLazyCounter added in v0.20.0

func NewLazyCounter(ctor func() gometrics.Counter) (gometrics.Counter, error)

NewLazyCounter build lazyCounter

func NewLazyEWMA added in v1.5.0

func NewLazyEWMA(ctor func() gometrics.EWMA) (gometrics.EWMA, error)

NewLazyEWMA build lazyEWMA

func NewLazyGauge added in v0.20.0

func NewLazyGauge(ctor func() gometrics.Gauge) (gometrics.Gauge, error)

NewLazyGauge build lazyGauge

func NewLazyHistogram added in v0.20.0

func NewLazyHistogram(ctor func() gometrics.Histogram) (gometrics.Histogram, error)

NewLazyHistogram build lazyHistogram

func NewListenerStats

func NewListenerStats(listenerName string) types.Metrics

NewListenerStats returns a stats with namespace prefix listsener

func NewMetrics

func NewMetrics(typ string, labels map[string]string) (types.Metrics, error)

NewMetrics returns a metrics Same (type + labels) pair will leading to the same Metrics instance

func NewMosnMetrics

func NewMosnMetrics() types.Metrics

NewMosnMetrics returns the basic metrics for mosn export the function for extension multiple calls will only make a metrics object

func NewNilMetrics

func NewNilMetrics(typ string, labels map[string]string) (types.Metrics, error)

func NewProxyStats

func NewProxyStats(proxyName string) types.Metrics

NewProxyStats returns a stats with namespace prefix proxy

func NewTLSStats added in v0.14.0

func NewTLSStats(name string) types.Metrics

NewTLSStats returns a TLSMetrics named ${name}

func RegisterSampleFactory added in v1.5.0

func RegisterSampleFactory(t SampleType, factory SampleFactory)

func ResetAll

func ResetAll()

ResetAll is only for test and internal usage. DO NOT use this if not sure.

func SetExpDecayAlpha added in v1.5.0

func SetExpDecayAlpha(alpha float64)

SetExpDecayAlpha set alpha of ExpDecaySample for Histogram

func SetGoVersion

func SetGoVersion(version string)

SetGoVersion set the go version

func SetMetricsFeature added in v0.20.0

func SetMetricsFeature(flushMosn, lazyFlush bool)

SetMetricsFeature enabled metrics feature

func SetSampleSize added in v1.5.0

func SetSampleSize(size int)

SetSampleSize set sample size for Histogram

func SetSampleType added in v1.5.0

func SetSampleType(t SampleType)

SetSampleType set sample type for Histogram

func SetStateCode

func SetStateCode(code int64)

SetStateCode set the mosn's running state's code

func SetStatsMatcher

func SetStatsMatcher(all bool, exclusionLabels, exclusionKeys []string)

SetStatsMatcher sets the exclusion labels and exclusion keys if a metrics labels/keys contains in exclusions, it will be ignored

func SetVersion

func SetVersion(version string)

SetVersion set the mosn's version

Types

type NilMetrics

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

NilMetrics is an implementation of types.Metrics it stores nothing except the metrics type and labels

func (*NilMetrics) Counter

func (m *NilMetrics) Counter(key string) gometrics.Counter

func (*NilMetrics) EWMA added in v1.5.0

func (m *NilMetrics) EWMA(key string, alpha float64) gometrics.EWMA

func (*NilMetrics) Each

func (m *NilMetrics) Each(f func(string, interface{}))

func (*NilMetrics) Gauge

func (m *NilMetrics) Gauge(key string) gometrics.Gauge

func (*NilMetrics) Histogram

func (m *NilMetrics) Histogram(key string) gometrics.Histogram

func (NilMetrics) Labels

func (s NilMetrics) Labels() map[string]string

func (NilMetrics) SortedLabels

func (s NilMetrics) SortedLabels() (keys, values []string)

func (NilMetrics) Type

func (s NilMetrics) Type() string

func (*NilMetrics) UnregisterAll

func (m *NilMetrics) UnregisterAll()

type SampleFactory added in v1.5.0

type SampleFactory func() gometrics.Sample

type SampleType added in v1.5.0

type SampleType string
const (
	SampleUniform  SampleType = "UNIFORM"
	SampleExpDecay SampleType = "EXP_DECAY"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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