go-redis/redis · error

failed to create maintenance notifications metric: %w

Error message

failed to create maintenance notifications metric: %w

What it means

Returned by createRecorder (redisotel.go:264) when meter.Int64Counter fails to create the 'redis.client.maintenance.notifications' instrument. Only checked when MetricGroupResiliency is enabled.

Source

Thrown at extra/redisotel-native/redisotel.go:264

	var maintenanceNotifications metric.Int64Counter

	if cfg.isMetricGroupEnabled(MetricGroupResiliency) {
		clientErrors, err = meter.Int64Counter(
			MetricClientErrors,
			metric.WithDescription("Number of errors handled by the Redis client"),
			metric.WithUnit("{error}"),
		)
		if err != nil {
			return nil, fmt.Errorf("failed to create client errors metric: %w", err)
		}

		maintenanceNotifications, err = meter.Int64Counter(
			MetricMaintenanceNotifications,
			metric.WithDescription("Number of maintenance notifications received"),
			metric.WithUnit("{notification}"),
		)
		if err != nil {
			return nil, fmt.Errorf("failed to create maintenance notifications metric: %w", err)
		}
	}

	var connectionWaitTime metric.Float64Histogram
	var connectionClosed metric.Int64Counter
	var connectionPendingReqs metric.Int64UpDownCounter // OTel semconv: UpDownCounter

	if cfg.isMetricGroupEnabled(MetricGroupConnectionAdvanced) {
		var connectionWaitTimeOpts []metric.Float64HistogramOption
		if cfg.histAggregation == HistogramAggregationExplicitBucket {
			connectionWaitTimeOpts = append(connectionWaitTimeOpts,
				metric.WithExplicitBucketBoundaries(cfg.bucketsConnectionWaitTime...),
			)
		}
		var connectionWaitTimeConv dbconv.ClientConnectionWaitTime
		connectionWaitTimeConv, err = dbconv.NewClientConnectionWaitTime(meter, connectionWaitTimeOpts...)
		if err != nil {
			return nil, fmt.Errorf("failed to create connection wait time histogram: %w", err)

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Reconcile other registrations of 'redis.client.maintenance.notifications' to use Int64Counter with matching unit '{notification}' and description
  2. Resolve redisotel version conflicts in go.mod
  3. Verify MeterProvider validity

Example fix

// before - conflicting description from another lib
meter.Int64Counter("redis.client.maintenance.notifications",
    metric.WithDescription("maintenance events"))

// after - match redisotel's description
meter.Int64Counter("redis.client.maintenance.notifications",
    metric.WithDescription("Number of maintenance notifications received"))
Defensive patterns

Strategy: try-catch

Try / catch

if err := obs.Init(cfg); err != nil {
    if strings.Contains(err.Error(), "maintenance notifications metric") {
        log.Error("conflict on 'redis.client.maintenance.notifications'; reconcile metadata")
    }
}

Prevention

When it happens

Trigger: Calling Init with MetricGroupFlagResiliency enabled, and the OTel SDK rejects the Counter creation.

Common situations: Another library registered 'redis.client.maintenance.notifications' with conflicting metadata; conflicting redisotel versions; broken MeterProvider.

Related errors


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/d2c5f67cf47d902f.json. Report an issue: GitHub.