Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapCoreWithLogMetrics ¶
func WrapCoreWithLogMetrics(monitor *LogMetricsMonitor, core zapcore.Core) zapcore.Core
WrapCoreWithLogMetrics returns a zapcore.Core that hooks into every write to increment the log-message counter for warn and error entries.
Types ¶
type Config ¶
type Config struct {
// Monitoring configuration
Monitoring RegistryConfig `json:"monitoring"`
}
type LogMetricsMonitor ¶
type LogMetricsMonitor struct {
// contains filtered or unexported fields
}
LogMetricsMonitor owns the log-message counter and implements the prometheus.Collector interface so it can be registered with the metrics registry like every other Monitor in cortex.
func NewLogMetricsMonitor ¶
func NewLogMetricsMonitor() LogMetricsMonitor
NewLogMetricsMonitor creates a new monitor for log-level metrics.
func (*LogMetricsMonitor) Collect ¶
func (m *LogMetricsMonitor) Collect(ch chan<- prometheus.Metric)
func (*LogMetricsMonitor) Describe ¶
func (m *LogMetricsMonitor) Describe(ch chan<- *prometheus.Desc)
type MetricsSlogHandler ¶
type MetricsSlogHandler struct {
// contains filtered or unexported fields
}
MetricsSlogHandler wraps an slog.Handler and increments the log-message counter for every warn or error log record.
func NewMetricsSlogHandler ¶
func NewMetricsSlogHandler(monitor *LogMetricsMonitor, next slog.Handler) *MetricsSlogHandler
NewMetricsSlogHandler returns a new handler that counts warn/error logs and delegates all calls to next.
type RegistererGatherer ¶
type RegistererGatherer interface {
prometheus.Registerer
prometheus.Gatherer
}
type Registry ¶
type Registry struct {
// Inherited prometheus registry.
RegistererGatherer
// contains filtered or unexported fields
}
Custom prometheus registry that adds functionality to the default registry.
func NewRegistry ¶
Create a new registry with the given configuration. This registry will include the default go collector and process collector.
func WrapRegistry ¶
func WrapRegistry(registry RegistererGatherer, config Config) *Registry
type RegistryConfig ¶
type RegistryConfig struct {
// The labels to add to all metrics.
Labels map[string]string `json:"labels"`
// The port to expose the metrics on.
Port int `json:"port"`
}
Configuration for our custom registry.