Documentation ¶
Index ¶
Constants ¶
const ( //MetricTypeFeed defines type for feed metric MetricTypeFeed = "feed" //MetricTypeTotal defines type for total metric MetricTypeTotal = "total" //MetricTypeFailed defines type for failed metric MetricTypeFailed = "failed" //MetricTypeSucceeded defines type for succeeded metric MetricTypeSucceeded = "succeeded" )
const (
//MetricsAddressCtxKey defines key for context value of the addres for server
MetricsAddressCtxKey = "metricsServerAddress"
)
Variables ¶
This section is empty.
Functions ¶
func RunServer ¶
RunServer - run server on the provided address and expose /metrics endpoint return 2 channels: first for getting error messages and second channel idenifies status of the server if second channel will be closed - server exited Context should contain under key "serverAddressMetrics" string with local address to which it will be binded If context cancelled - server also exits
Types ¶
type Adder ¶
type Adder interface {
Add(float64)
}
Adder add value from param to internal value Gauge and Counter both support method Add the only difference is that val could not be negative for Counter those metrics are thread safe and use package atomic no need to add another atomic operations
type Container ¶
Container holds all metrics
func NewMetrics ¶
NewMetrics creates container with all metrics per feed
func (Container) GetMetric ¶
GetMetric returns metric configured. If metric could not be found returns error.
func (Container) IncrementMetric ¶
IncrementMetric increments metric