Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( AttrListener = attribute.Key("listener") AttrUser = attribute.Key("user") AttrMode = attribute.Key("mode") AttrBackend = attribute.Key("backend") AttrErrorType = attribute.Key("error_type") AttrLimitType = attribute.Key("limit_type") AttrDatabase = attribute.Key("database") AttrOperation = attribute.Key("operation") )
Attribute key constants for metric tagging.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Endpoint string `toml:"endpoint"`
Protocol string `toml:"protocol"` // "http" (default) or "grpc"
Interval string `toml:"interval"`
Temporality string `toml:"temporality"` // "delta" (default) or "cumulative"
TracingSampleRate float64 `toml:"tracing_sample_rate"` // 0 = disabled, 0.0-1.0 = sample rate
Enable map[string][]string `toml:"enable"`
}
Config mirrors the TOML metrics section.
func (Config) IntervalDuration ¶
IntervalDuration parses the interval string. Defaults to 30s.
func (Config) IsMetricEnabled ¶
IsMetricEnabled returns true if the metric name appears in the enable map.
func (Config) TagsForMetric ¶
TagsForMetric returns the tag allow-list for a metric name.
func (Config) TemporalitySelector ¶ added in v0.6.6
func (c Config) TemporalitySelector() (sdkmetric.TemporalitySelector, error)
TemporalitySelector returns the export temporality for OTel metrics. Delta is the default because Datadog handles monotonic sums and histograms most reliably in delta form. UpDownCounters still export cumulative.
type Metrics ¶
type Metrics struct {
// Connection metrics.
ConnActive metric.Int64UpDownCounter
ConnTotal metric.Int64Counter
ConnDuration metric.Float64Histogram
ConnRejected metric.Int64Counter
// Auth metrics.
AuthAttempts metric.Int64Counter
AuthFailures metric.Int64Counter
AuthLatency metric.Float64Histogram
// Revalidation metrics.
RevalAttempts metric.Int64Counter
RevalFailures metric.Int64Counter
// Byte metrics.
BytesRead metric.Int64Counter
BytesWritten metric.Int64Counter
// Limit metrics.
LimitViolations metric.Int64Counter
// Provision metrics.
ProvisionTotal metric.Int64Counter
ProvisionLatency metric.Float64Histogram
ProvisionErrors metric.Int64Counter
// Redis metrics.
RedisOpDuration metric.Float64Histogram
RedisErrors metric.Int64Counter
// System metrics.
SystemListeners metric.Int64UpDownCounter
// contains filtered or unexported fields
}
Metrics holds all OTel instruments for waypoint.
func New ¶
New creates a new Metrics instance. If cfg.Endpoint is empty, all instruments are noop (zero overhead). Only metrics listed in cfg.Enable are active.
func NewWithProvider ¶
func NewWithProvider(provider metric.MeterProvider, cfg Config) (*Metrics, error)
NewWithProvider creates Metrics using an explicit MeterProvider (for testing).
func (*Metrics) Attrs ¶
Attrs filters attributes for the given metric, keeping only tags in that metric's allow-list (or all if "*"). Returns a MeasurementOption.
func (*Metrics) MeterProvider ¶ added in v0.6.6
func (m *Metrics) MeterProvider() metric.MeterProvider
MeterProvider returns the provider backing this metrics instance.