Documentation ¶
Index ¶
- Constants
- Variables
- func AddListenerAddr(addr string)
- func GetAll() (metrics []types.Metrics)
- func GetMetricsFilter(filter string) (metrics types.Metrics)
- func GetProxyTotal() (metrics types.Metrics)
- func NewClusterStats(clusterName string) types.Metrics
- func NewHealthStats(serviceName string) types.Metrics
- func NewHostStats(clusterName string, addr string) types.Metrics
- func NewLazyCounter(ctor func() gometrics.Counter) (gometrics.Counter, error)
- func NewLazyEWMA(ctor func() gometrics.EWMA) (gometrics.EWMA, error)
- func NewLazyGauge(ctor func() gometrics.Gauge) (gometrics.Gauge, error)
- func NewLazyHistogram(ctor func() gometrics.Histogram) (gometrics.Histogram, error)
- func NewListenerStats(listenerName string) types.Metrics
- func NewMetrics(typ string, labels map[string]string) (types.Metrics, error)
- func NewMosnMetrics() types.Metrics
- func NewNilMetrics(typ string, labels map[string]string) (types.Metrics, error)
- func NewProxyStats(proxyName string) types.Metrics
- func NewTLSStats(name string) types.Metrics
- func RegisterSampleFactory(t SampleType, factory SampleFactory)
- func ResetAll()
- func SetExpDecayAlpha(alpha float64)
- func SetGoVersion(version string)
- func SetMetricsFeature(flushMosn, lazyFlush bool)
- func SetSampleSize(size int)
- func SetSampleType(t SampleType)
- func SetStateCode(code int64)
- func SetStatsMatcher(all bool, exclusionLabels, exclusionKeys []string)
- func SetVersion(version string)
- type NilMetrics
- func (m *NilMetrics) Counter(key string) gometrics.Counter
- func (m *NilMetrics) EWMA(key string, alpha float64) gometrics.EWMA
- func (m *NilMetrics) Each(f func(string, interface{}))
- func (m *NilMetrics) Gauge(key string) gometrics.Gauge
- func (m *NilMetrics) Histogram(key string) gometrics.Histogram
- func (s NilMetrics) Labels() map[string]string
- func (s NilMetrics) SortedLabels() (keys, values []string)
- func (s NilMetrics) Type() string
- func (m *NilMetrics) UnregisterAll()
- type SampleFactory
- type SampleType
Constants ¶
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
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
const ( GoVersion = "go_version:" Version = "version:" ListenerAddr = "listener_address:" StateCode = "mosn_state_code" )
mosn basic info metrics
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
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
const DownstreamType = "downstream"
DownstreamType represents downstream metrics type
const HealthCheckType = "healthcheck"
HealthCheckType represents health check metrics type
const MaxLabelCount = 20
const MosnMetaType = "meta"
MosnMetaType represents mosn basic metrics type
const (
TLSConnpoolChanged = "connpool_changed"
)
tls metrics key
const TLSType = "mosn_tls"
TLSType represents tls metrics type
const UpstreamType = "upstream"
UpstreamType represents upstream metrics type
Variables ¶
var ( // FlushMosnMetrics marks output mosn information metrics or not, default is false FlushMosnMetrics bool // LazyFlushMetrics marks flush data with lazy mode LazyFlushMetrics bool )
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") )
var (
ErrLabelCountExceeded = fmt.Errorf("label count exceeded, max is %d", MaxLabelCount)
)
Functions ¶
func GetMetricsFilter ¶ added in v0.18.0
filter is type.labels see example in `GetProxyTotal`
func GetProxyTotal ¶ added in v0.14.0
GetProxyTotal returns proxy global metrics data
func NewClusterStats ¶
NewClusterStats returns a stats with namespace prefix cluster
func NewHealthStats ¶
NewHealthStats returns a stats with namespace prefix service
func NewHostStats ¶
NewHostStats returns a stats that namespace contains cluster and host address
func NewLazyCounter ¶ added in v0.20.0
NewLazyCounter build lazyCounter
func NewLazyEWMA ¶ added in v1.5.0
NewLazyEWMA build lazyEWMA
func NewLazyGauge ¶ added in v0.20.0
NewLazyGauge build lazyGauge
func NewLazyHistogram ¶ added in v0.20.0
NewLazyHistogram build lazyHistogram
func NewListenerStats ¶
NewListenerStats returns a stats with namespace prefix listsener
func NewMetrics ¶
NewMetrics returns a metrics Same (type + labels) pair will leading to the same Metrics instance
func NewMosnMetrics ¶
NewMosnMetrics returns the basic metrics for mosn export the function for extension multiple calls will only make a metrics object
func NewNilMetrics ¶
func NewProxyStats ¶
NewProxyStats returns a stats with namespace prefix proxy
func NewTLSStats ¶ added in v0.14.0
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 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 SetStatsMatcher ¶
SetStatsMatcher sets the exclusion labels and exclusion keys if a metrics labels/keys contains in exclusions, it will be ignored
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) 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) SortedLabels ¶
func (s NilMetrics) SortedLabels() (keys, values []string)
func (*NilMetrics) UnregisterAll ¶
func (m *NilMetrics) UnregisterAll()
type SampleFactory ¶ added in v1.5.0
type SampleType ¶ added in v1.5.0
type SampleType string
const ( SampleUniform SampleType = "UNIFORM" SampleExpDecay SampleType = "EXP_DECAY" )