Documentation ¶
Overview ¶
Package metrics defines a set of basic building blocks for instrumenting KrakenD gateways
Check the "github.com/devopsfaith/krakend-metrics/gin" and "github.com/devopsfaith/krakend-metrics/mux" packages for complete implementations
Index ¶
- Constants
- func ConfigGetter(e config.ExtraConfig) interface{}
- func NewDummyRegistry() metrics.Registry
- func NewProxyMiddleware(layer, name string, pm *ProxyMetrics) proxy.Middleware
- type Config
- type DummyRegistry
- func (r DummyRegistry) Each(_ func(string, interface{}))
- func (r DummyRegistry) Get(_ string) interface{}
- func (r DummyRegistry) GetAll() map[string]map[string]interface{}
- func (r DummyRegistry) GetOrRegister(_ string, i interface{}) interface{}
- func (r DummyRegistry) Register(_ string, _ interface{}) error
- func (r DummyRegistry) RunHealthchecks()
- func (r DummyRegistry) Unregister(_ string)
- func (r DummyRegistry) UnregisterAll()
- type HistogramData
- type Metrics
- func (m *Metrics) BackendFactory(segmentName string, next proxy.BackendFactory) proxy.BackendFactory
- func (m *Metrics) DefaultBackendFactory() proxy.BackendFactory
- func (m *Metrics) NewProxyMiddleware(layer, name string) proxy.Middleware
- func (m *Metrics) ProxyFactory(segmentName string, next proxy.Factory) proxy.FactoryFunc
- func (m *Metrics) Snapshot() Stats
- func (m *Metrics) TakeSnapshot() Stats
- type ProxyMetrics
- type RouterMetrics
- type Stats
Constants ¶
const Namespace = "github_com/devopsfaith/krakend-metrics"
Namespace is the key to look for extra configuration details
Variables ¶
This section is empty.
Functions ¶
func ConfigGetter ¶
func ConfigGetter(e config.ExtraConfig) interface{}
ConfigGetter implements the config.ConfigGetter interface. It parses the extra config for the collectors and returns a defaultCfg if something goes wrong.
func NewDummyRegistry ¶
func NewDummyRegistry() metrics.Registry
func NewProxyMiddleware ¶
func NewProxyMiddleware(layer, name string, pm *ProxyMetrics) proxy.Middleware
NewProxyMiddleware creates a proxy middleware ready to be injected in the pipe as instrumentation point
Types ¶
type Config ¶
type Config struct { ProxyDisabled bool RouterDisabled bool BackendDisabled bool CollectionTime time.Duration ListenAddr string EndpointDisabled bool }
Config holds if a component is active or not
type DummyRegistry ¶
type DummyRegistry struct{}
DummyRegistry implements the rcrowley/go-metrics.Registry interface
func (DummyRegistry) Each ¶
func (r DummyRegistry) Each(_ func(string, interface{}))
func (DummyRegistry) Get ¶
func (r DummyRegistry) Get(_ string) interface{}
func (DummyRegistry) GetAll ¶
func (r DummyRegistry) GetAll() map[string]map[string]interface{}
func (DummyRegistry) GetOrRegister ¶
func (r DummyRegistry) GetOrRegister(_ string, i interface{}) interface{}
func (DummyRegistry) Register ¶
func (r DummyRegistry) Register(_ string, _ interface{}) error
func (DummyRegistry) RunHealthchecks ¶
func (r DummyRegistry) RunHealthchecks()
func (DummyRegistry) Unregister ¶
func (r DummyRegistry) Unregister(_ string)
func (DummyRegistry) UnregisterAll ¶
func (r DummyRegistry) UnregisterAll()
type HistogramData ¶
type HistogramData struct { Max int64 Min int64 Mean float64 Stddev float64 Variance float64 Percentiles []float64 }
HistogramData is a snapshot of an actual histogram
type Metrics ¶
type Metrics struct { // Config is the metrics collector configuration Config *Config // Proxy is the metrics collector for the proxy package Proxy *ProxyMetrics // Router is the metrics collector for the router package Router *RouterMetrics // Registry is the metrics register Registry *metrics.Registry // contains filtered or unexported fields }
Metrics is the component that manages all the metrics
func (*Metrics) BackendFactory ¶
func (m *Metrics) BackendFactory(segmentName string, next proxy.BackendFactory) proxy.BackendFactory
BackendFactory creates an instrumented backend factory
func (*Metrics) DefaultBackendFactory ¶
func (m *Metrics) DefaultBackendFactory() proxy.BackendFactory
DefaultBackendFactory creates an instrumented default HTTP backend factory
func (*Metrics) NewProxyMiddleware ¶
func (m *Metrics) NewProxyMiddleware(layer, name string) proxy.Middleware
NewProxyMiddleware creates a proxy middleware ready to be injected in the pipe as instrumentation point
func (*Metrics) ProxyFactory ¶
ProxyFactory creates an instrumented proxy factory
func (*Metrics) TakeSnapshot ¶
TakeSnapshot takes a snapshot of the current state
type ProxyMetrics ¶
type ProxyMetrics struct {
// contains filtered or unexported fields
}
ProxyMetrics is the metrics collector for the proxy package
func NewProxyMetrics ¶
func NewProxyMetrics(parent *metrics.Registry) *ProxyMetrics
NewProxyMetrics creates a ProxyMetrics using the injected registry
func (*ProxyMetrics) Counter ¶
func (rm *ProxyMetrics) Counter(labels ...string) metrics.Counter
Counter gets or register a counter
func (*ProxyMetrics) Histogram ¶
func (rm *ProxyMetrics) Histogram(labels ...string) metrics.Histogram
Histogram gets or register a histogram
type RouterMetrics ¶
type RouterMetrics struct { ProxyMetrics // contains filtered or unexported fields }
RouterMetrics is the metrics collector for the router package
func NewRouterMetrics ¶
func NewRouterMetrics(parent *metrics.Registry) *RouterMetrics
NewRouterMetrics creates a RouterMetrics using the injected registry
func (*RouterMetrics) Aggregate ¶
func (rm *RouterMetrics) Aggregate()
func (*RouterMetrics) Connection ¶
func (rm *RouterMetrics) Connection(TLS *tls.ConnectionState)
Connection adds one to the internal connected counter
func (*RouterMetrics) Disconnection ¶
func (rm *RouterMetrics) Disconnection()
Disconnection adds one to the internal disconnected counter
func (*RouterMetrics) RegisterResponseWriterMetrics ¶
func (rm *RouterMetrics) RegisterResponseWriterMetrics(name string)
Directories ¶
Path | Synopsis |
---|---|
Package gin defines a set of basic building blocks for instrumenting KrakenD gateways built using the gin router
|
Package gin defines a set of basic building blocks for instrumenting KrakenD gateways built using the gin router |
Package mux defines a set of basic building blocks for instrumenting KrakenD gateways built using the mux router
|
Package mux defines a set of basic building blocks for instrumenting KrakenD gateways built using the mux router |