MCPcopy
hub / github.com/redis/go-redis / NewConfig

Function NewConfig

extra/redisotel-native/config.go:173–198  ·  view source on GitHub ↗

NewConfig creates a new Config with default values. Default configuration: - Enabled: false (must explicitly enable) - MetricGroups: all metric groups (command, connection, resiliency, pubsub, stream) - HistogramAggregation: explicit bucket - Buckets: 0.1ms to 10s (suitable for Redis operations) Ex

()

Source from the content-addressed store, hash-verified

171// WithEnabled(true).
172// WithMetricGroups(redisotel.MetricGroupFlagConnectionBasic | redisotel.MetricGroupFlagResiliency)
173func NewConfig() *Config {
174 return &Config{
175 Enabled: false,
176 MeterProvider: nil, // Will use global otel.GetMeterProvider() if nil
177
178 // Default metric groups: all groups enabled for comprehensive observability
179 MetricGroups: MetricGroupAll,
180
181 // No command filtering by default
182 IncludeCommands: nil,
183 ExcludeCommands: nil,
184
185 // Don't hide labels by default
186 HidePubSubChannelNames: false,
187 HideStreamNames: false,
188
189 // Use explicit bucket histogram by default
190 HistogramAggregation: HistogramAggregationExplicitBucket,
191
192 // Default buckets for all duration metrics
193 BucketsOperationDuration: defaultHistogramBuckets(),
194 BucketsStreamLag: defaultHistogramBuckets(),
195 BucketsConnectionCreateTime: defaultHistogramBuckets(),
196 BucketsConnectionWaitTime: defaultHistogramBuckets(),
197 }
198}
199
200// WithEnabled enables or disables metrics emission.
201// Default: false (must explicitly enable)

Callers 2

TestMetricsUnderStressFunction · 0.85

Calls 1

defaultHistogramBucketsFunction · 0.85

Tested by 2

TestMetricsUnderStressFunction · 0.68