metrics

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package metrics provides OPTIONAL infrastructure adapters for recording transformation metrics (in-memory, Prometheus, or async).

This package is NOT required for core data transformation functionality. It is provided as a convenience for observability. Most teams already have their own metrics stack (OpenTelemetry, DataDog, etc.) — use this only if it fits your needs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNoopMetrics

func NewNoopMetrics() port.MetricsPort

NewNoopMetrics creates a no-op metrics adapter

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory creates metrics port implementations

func NewDefaultFactory

func NewDefaultFactory() *Factory

NewDefaultFactory creates a factory with sensible defaults

func NewFactory

func NewFactory(config FactoryConfig) *Factory

NewFactory creates a new metrics factory

func (*Factory) Create

func (f *Factory) Create(ctx context.Context) (port.MetricsPort, error)

Create instantiates a metrics adapter based on configuration

type FactoryConfig

type FactoryConfig struct {
	// Type of metrics adapter: "memory", "prometheus", or "noop"
	Type string

	// EnableAsync wraps the metrics adapter with async behavior
	EnableAsync bool

	// AsyncBufferSize is the size of async operation queue
	AsyncBufferSize int

	// AsyncSamplingRate is sampling rate for async (0.0 to 1.0)
	AsyncSamplingRate float64
}

FactoryConfig contains configuration for metrics factory

type NoopMetrics

type NoopMetrics struct{}

NoopMetrics is a no-op implementation of MetricsPort

func (*NoopMetrics) IncrementCounter

func (n *NoopMetrics) IncrementCounter(metric string, value int64)

IncrementCounter implements port.MetricsPort (no-op)

func (*NoopMetrics) RecordDuration

func (n *NoopMetrics) RecordDuration(operation string, duration time.Duration)

RecordDuration implements port.MetricsPort (no-op)

func (*NoopMetrics) RecordHistogram

func (n *NoopMetrics) RecordHistogram(metric string, value float64)

RecordHistogram implements port.MetricsPort (no-op)

func (*NoopMetrics) SetGauge

func (n *NoopMetrics) SetGauge(metric string, value float64)

SetGauge implements port.MetricsPort (no-op)

Directories

Path Synopsis
Package async provides a non-blocking metrics adapter with configurable buffer size and sampling rate for high-throughput applications.
Package async provides a non-blocking metrics adapter with configurable buffer size and sampling rate for high-throughput applications.
Package memory provides an in-memory metrics adapter for testing and development.
Package memory provides an in-memory metrics adapter for testing and development.
Package prometheus provides a Prometheus-compatible metrics adapter that exposes counters, gauges, and histograms via the Prometheus client.
Package prometheus provides a Prometheus-compatible metrics adapter that exposes counters, gauges, and histograms via the Prometheus client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL