Documentation ¶
Index ¶
- Constants
- func GetCloudWatchNamespace(config cfg.Config) string
- func LoggerHandlerFactory(_ cfg.Config, _ string) (log.Handler, error)
- func NewCwWriterWithInterfaces(logger log.Logger, clock clock.Clock, cw gosoCloudwatch.Client, ...) *cwWriter
- func NewEsWriter(config cfg.Config, logger log.Logger) (*esWriter, error)
- func NewEsWriterWithInterfaces(logger log.Logger, client *es.ClientV7, clock clock.Clock, namespace string) *esWriter
- func NewMetricModule(ctx context.Context, config cfg.Config, logger log.Logger) (kernel.Module, error)
- func NewMetricServer(ctx context.Context, config cfg.Config, logger log.Logger) (kernel.Module, error)
- func NewMetricServerWithInterfaces(logger log.Logger, registry *prometheus.Registry, channel *metricChannel, ...) (*metricsServer, error)
- func NewPromWriter(ctx context.Context, config cfg.Config, logger log.Logger) (*promWriter, error)
- func NewPromWriterWithInterfaces(logger log.Logger, registry *prometheus.Registry, namespace string, ...) *promWriter
- func ProvideRegistry(ctx context.Context, name string) (*prometheus.Registry, error)
- func ProviderMetricChannel() *metricChannel
- func RegisterCustomUnit(unit types.StandardUnit, standardUnit types.StandardUnit, ...)
- func WithPromNSNamingStrategy(strategy NamingFactory)
- type BatchedMetricDatum
- type Cloudwatch
- type Daemon
- type Data
- type Datum
- type Dimensions
- type LoggerHandler
- type NamingFactory
- type NamingSettings
- type PromServerSettings
- type PromSettings
- type Settings
- type StandardUnit
- type TimeoutSettings
- type Writer
- func NewCwWriter(ctx context.Context, config cfg.Config, logger log.Logger) (Writer, error)
- func NewWriter(defaults ...*Datum) Writer
- func NewWriterWithInterfaces(clock clock.Clock, channel *metricChannel) Writer
- func ProvideMetricWriterByType(ctx context.Context, config cfg.Config, logger log.Logger, typ string) (Writer, error)
Constants ¶
View Source
const ( UnitCountAverage = types.StandardUnit("UnitCountAverage") UnitCountMaximum = types.StandardUnit("UnitCountMaximum") UnitCountMinimum = types.StandardUnit("UnitCountMinimum") UnitSecondsAverage = types.StandardUnit("UnitSecondsAverage") UnitSecondsMaximum = types.StandardUnit("UnitSecondsMaximum") UnitSecondsMinimum = types.StandardUnit("UnitSecondsMinimum") UnitMillisecondsAverage = types.StandardUnit("UnitMillisecondsAverage") UnitMillisecondsMaximum = types.StandardUnit("UnitMillisecondsMaximum") UnitMillisecondsMinimum = types.StandardUnit("UnitMillisecondsMinimum") )
View Source
const ( PriorityLow = 1 PriorityHigh = 2 UnitCount = types.StandardUnitCount UnitSeconds = types.StandardUnitSeconds UnitMilliseconds = types.StandardUnitMilliseconds )
View Source
const ( WriterTypeCw = "cw" WriterTypeES = "es" WriterTypeProm = "prom" )
Variables ¶
This section is empty.
Functions ¶
func GetCloudWatchNamespace ¶ added in v0.22.0
func NewMetricModule ¶
func NewMetricServer ¶
func NewMetricServerWithInterfaces ¶
func NewMetricServerWithInterfaces( logger log.Logger, registry *prometheus.Registry, channel *metricChannel, writer Writer, s *PromSettings, ) (*metricsServer, error)
func NewPromWriter ¶
func ProvideRegistry ¶
func ProviderMetricChannel ¶
func ProviderMetricChannel() *metricChannel
func RegisterCustomUnit ¶
func RegisterCustomUnit(unit types.StandardUnit, standardUnit types.StandardUnit, reducer func(xs []float64) float64)
func WithPromNSNamingStrategy ¶
func WithPromNSNamingStrategy(strategy NamingFactory)
Types ¶
type BatchedMetricDatum ¶
type BatchedMetricDatum struct { Priority int Timestamp time.Time MetricName string Dimensions Dimensions Values []float64 Unit types.StandardUnit }
type Cloudwatch ¶
type Cloudwatch struct {
Naming NamingSettings `cfg:"naming"`
}
type Daemon ¶
func (*Daemon) IsBackground ¶
func (*Daemon) IsEssential ¶
type Datum ¶
type Datum struct { Priority int `json:"-"` Timestamp time.Time `json:"timestamp"` MetricName string `json:"metricName"` Dimensions Dimensions `json:"dimensions"` Value float64 `json:"value"` Unit StandardUnit `json:"unit"` }
func (*Datum) DimensionKey ¶
type Dimensions ¶
type LoggerHandler ¶
type LoggerHandler struct {
// contains filtered or unexported fields
}
func NewLoggerHandler ¶
func NewLoggerHandler() *LoggerHandler
func (LoggerHandler) Channels ¶
func (h LoggerHandler) Channels() []string
func (LoggerHandler) Level ¶
func (h LoggerHandler) Level() int
type NamingFactory ¶
type NamingSettings ¶
type NamingSettings struct {
Pattern string `cfg:"pattern,nodecode" default:"{project}/{env}/{family}/{group}-{app}"`
}
type PromServerSettings ¶
type PromServerSettings struct { Enabled bool `cfg:"enabled" default:"true"` Port int `cfg:"port" default:"8092"` Path string `cfg:"path" default:"/metrics"` Timeout TimeoutSettings `cfg:"timeout"` }
type PromSettings ¶
type PromSettings struct { // MetricLimit is used to avoid having metrics for which the name is programmatically generated (or have large number // of possible dimensions) which could lead in a memory leak. MetricLimit int64 `cfg:"metric_limit" default:"10000"` Api PromServerSettings `cfg:"api"` }
type StandardUnit ¶
type StandardUnit = types.StandardUnit
const ( UnitPromCounter StandardUnit = "prom-counter" UnitPromGauge StandardUnit = "prom-gauge" UnitPromHistogram StandardUnit = "prom-histogram" UnitPromSummary StandardUnit = "prom-summary" )
type TimeoutSettings ¶
type TimeoutSettings struct { // You need to give at least 1s as timeout. // Read timeout is the maximum duration for reading the entire request, including the body. Read time.Duration `cfg:"read" default:"60s" validate:"min=1000000000"` // Write timeout is the maximum duration before timing out writes of the response. Write time.Duration `cfg:"write" default:"60s" validate:"min=1000000000"` // Idle timeout is the maximum amount of time to wait for the next request when keep-alives are enabled Idle time.Duration `cfg:"idle" default:"60s" validate:"min=1000000000"` }
TimeoutSettings configures IO timeouts.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.