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 ¶
func StartProfiling ¶ added in v0.6.8
StartProfiling starts the Datadog continuous profiler when DD_PROFILING_ENABLED is truthy, and returns a stop function (always safe to call, even when profiling is disabled or failed to start).
Service, environment, version, and the agent connection are read from the standard DD_* environment variables (DD_SERVICE, DD_ENV, DD_VERSION, and DD_AGENT_HOST / DD_TRACE_AGENT_URL). In the Kubernetes deployment these come from the pod's Datadog unified-tagging labels and the node-local agent host.
Note: waypoint uses OpenTelemetry for tracing rather than the dd-trace-go tracer, so these profiles are NOT correlated with spans (no Code Hotspots / endpoint profiling). What this provides is the full set of Go runtime profiles — CPU, heap, goroutine, mutex, and block — which an out-of-process profiler cannot capture.
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.