Documentation ¶
Index ¶
- Constants
- func GetCloudWatchNamespace(config cfg.Config) string
- func LoggerHandlerFactory(_ cfg.Config, _ string) (log.Handler, error)
- func NewCloudwatchWriterWithInterfaces(logger log.Logger, clock clock.Clock, cw gosoCloudwatch.Client, ...) *cloudwatchWriter
- func NewDaemonModule(ctx context.Context, config cfg.Config, logger log.Logger) (kernel.Module, error)
- func NewMetricDaemonWithInterfaces(logger log.Logger, channel *metricChannel, writer Writer, settings *Settings) (kernel.Module, error)
- func NewMetricServerWithInterfaces(logger log.Logger, registry *prometheus.Registry, s *PromSettings) (*metricsServer, error)
- func NewPrometheusMetricServer(ctx context.Context, config cfg.Config, logger log.Logger) (kernel.Module, error)
- func NewPrometheusMetricsServerModule(ctx context.Context, config cfg.Config, logger log.Logger) (kernel.Module, error)
- 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 NewCloudwatchWriter(ctx context.Context, config cfg.Config, logger log.Logger) (Writer, error)
- func NewElasticsearchWriter(_ context.Context, config cfg.Config, logger log.Logger) (Writer, error)
- func NewElasticsearchWriterWithInterfaces(logger log.Logger, client *es.ClientV7, clock clock.Clock, namespace string) Writer
- func NewMetricWriter(ctx context.Context, config cfg.Config, logger log.Logger, types []string) (Writer, error)
- func NewMultiWriterWithInterfaces(writers []Writer) Writer
- func NewPrometheusWriter(ctx context.Context, config cfg.Config, logger log.Logger) (Writer, error)
- func NewPrometheusWriterWithInterfaces(logger log.Logger, registry *prometheus.Registry, namespace string, ...) Writer
- func NewWriter(defaults ...*Datum) Writer
- func NewWriterWithInterfaces(clock clock.Clock, channel *metricChannel) Writer
- func ProvideCloudwatchWriter(ctx context.Context, config cfg.Config, logger log.Logger) (Writer, error)
- func ProvideElasticsearchWriter(ctx context.Context, config cfg.Config, logger log.Logger) (Writer, error)
- func ProvidePrometheusWriter(ctx context.Context, config cfg.Config, logger log.Logger) (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 ( WriterTypeCloudwatch = "cw" WriterTypeElasticsearch = "es" WriterTypePrometheus = "prom" )
Variables ¶
This section is empty.
Functions ¶
func GetCloudWatchNamespace ¶ added in v0.22.0
func NewCloudwatchWriterWithInterfaces ¶ added in v0.32.0
func NewDaemonModule ¶ added in v0.32.0
func NewMetricServerWithInterfaces ¶
func NewMetricServerWithInterfaces( logger log.Logger, registry *prometheus.Registry, s *PromSettings, ) (*metricsServer, error)
func NewPrometheusMetricServer ¶ added in v0.32.0
func NewPrometheusMetricsServerModule ¶ added in v0.32.0
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 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) DimensionKV ¶ added in v0.32.1
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.
type Writer ¶
func NewCloudwatchWriter ¶ added in v0.32.0
func NewElasticsearchWriter ¶ added in v0.32.0
func NewElasticsearchWriterWithInterfaces ¶ added in v0.32.0
func NewMetricWriter ¶ added in v0.32.0
func NewMultiWriterWithInterfaces ¶ added in v0.32.0
func NewPrometheusWriter ¶ added in v0.32.0
func NewPrometheusWriterWithInterfaces ¶ added in v0.32.0
func NewWriterWithInterfaces ¶
func ProvideCloudwatchWriter ¶ added in v0.32.0
func ProvideElasticsearchWriter ¶ added in v0.32.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.