Skip to content

Commit

Permalink
Merge pull request #479 from redis/fix-otel-missing-attrs
Browse files Browse the repository at this point in the history
fix: panic rueidisotel without MetricAttrs and TraceAttrs
  • Loading branch information
rueian committed Feb 24, 2024
2 parents 933c142 + d9c9b99 commit 152800b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rueidisotel/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/trace"
)

var (
Expand Down Expand Up @@ -106,7 +107,10 @@ func NewClient(clientOption rueidis.ClientOption, opts ...Option) (rueidis.Clien
}

func newClient(opts ...Option) (*otelclient, error) {
cli := &otelclient{}
cli := &otelclient{
mAttrs: metric.WithAttributes(),
tAttrs: trace.WithAttributes(),
}
for _, opt := range opts {
opt(cli)
}
Expand Down

0 comments on commit 152800b

Please sign in to comment.