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

Method configToInternal

extra/redisotel-native/redisotel.go:142–177  ·  view source on GitHub ↗

configToInternal converts the public Config to internal config format

(cfg *Config)

Source from the content-addressed store, hash-verified

140
141// configToInternal converts the public Config to internal config format
142func (o *ObservabilityInstance) configToInternal(cfg *Config) config {
143 enabledGroups := make(map[MetricGroup]bool)
144 if cfg.MetricGroups&MetricGroupFlagCommand != 0 {
145 enabledGroups[MetricGroupCommand] = true
146 }
147 if cfg.MetricGroups&MetricGroupFlagConnectionBasic != 0 {
148 enabledGroups[MetricGroupConnectionBasic] = true
149 }
150 if cfg.MetricGroups&MetricGroupFlagResiliency != 0 {
151 enabledGroups[MetricGroupResiliency] = true
152 }
153 if cfg.MetricGroups&MetricGroupFlagConnectionAdvanced != 0 {
154 enabledGroups[MetricGroupConnectionAdvanced] = true
155 }
156 if cfg.MetricGroups&MetricGroupFlagPubSub != 0 {
157 enabledGroups[MetricGroupPubSub] = true
158 }
159 if cfg.MetricGroups&MetricGroupFlagStream != 0 {
160 enabledGroups[MetricGroupStream] = true
161 }
162
163 return config{
164 meterProvider: cfg.MeterProvider,
165 enabled: cfg.Enabled,
166 enabledMetricGroups: enabledGroups,
167 includeCommands: cfg.IncludeCommands,
168 excludeCommands: cfg.ExcludeCommands,
169 hidePubSubChannelNames: cfg.HidePubSubChannelNames,
170 hideStreamNames: cfg.HideStreamNames,
171 histAggregation: cfg.HistogramAggregation,
172 bucketsOperationDuration: cfg.BucketsOperationDuration,
173 bucketsStreamProcessingDuration: cfg.BucketsStreamLag,
174 bucketsConnectionCreateTime: cfg.BucketsConnectionCreateTime,
175 bucketsConnectionWaitTime: cfg.BucketsConnectionWaitTime,
176 }
177}
178
179// createRecorder creates a metricsRecorder with all instruments based on config.
180func (o *ObservabilityInstance) createRecorder(meter metric.Meter, cfg config) (*metricsRecorder, error) {

Callers 1

InitMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected