Skip to content

Commit 2caa9d4

Browse files
committed
Address comments
Signed-off-by: Jason Parraga <[email protected]>
1 parent 83c73f2 commit 2caa9d4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

extra/redisotel/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func newConfig(opts ...baseOption) *config {
6565
mp: otel.GetMeterProvider(),
6666
dbStmtEnabled: true,
6767
callerEnabled: true,
68-
filter: defaultCommandFilter,
6968
}
7069

7170
for _, opt := range opts {
@@ -137,7 +136,7 @@ func WithCommandFilter(filter func(cmd redis.Cmder) bool) TracingOption {
137136
})
138137
}
139138

140-
func defaultCommandFilter(cmd redis.Cmder) bool {
139+
func BasicCommandFilter(cmd redis.Cmder) bool {
141140
if strings.ToLower(cmd.Name()) == "auth" {
142141
return true
143142
}

extra/redisotel/tracing_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ func TestWithCommandFilter(t *testing.T) {
151151
}
152152
})
153153

154-
t.Run("auth command filtered by default", func(t *testing.T) {
154+
t.Run("auth command filtered with basic command filter", func(t *testing.T) {
155155
provider := sdktrace.NewTracerProvider()
156156
hook := newTracingHook(
157157
"",
158158
WithTracerProvider(provider),
159+
WithCommandFilter(BasicCommandFilter),
159160
)
160161
ctx, span := provider.Tracer("redis-test").Start(context.TODO(), "redis-test")
161162
cmd := redis.NewCmd(ctx, "auth", "test-password")
@@ -175,11 +176,12 @@ func TestWithCommandFilter(t *testing.T) {
175176
}
176177
})
177178

178-
t.Run("hello command filtered by default when sensitive", func(t *testing.T) {
179+
t.Run("hello command filtered with basic command filter when sensitive", func(t *testing.T) {
179180
provider := sdktrace.NewTracerProvider()
180181
hook := newTracingHook(
181182
"",
182183
WithTracerProvider(provider),
184+
WithCommandFilter(BasicCommandFilter),
183185
)
184186
ctx, span := provider.Tracer("redis-test").Start(context.TODO(), "redis-test")
185187
cmd := redis.NewCmd(ctx, "hello", 3, "AUTH", "test-user", "test-password")
@@ -199,11 +201,12 @@ func TestWithCommandFilter(t *testing.T) {
199201
}
200202
})
201203

202-
t.Run("hello command not filtered by default when not sensitive", func(t *testing.T) {
204+
t.Run("hello command not filtered with basic command filter when not sensitive", func(t *testing.T) {
203205
provider := sdktrace.NewTracerProvider()
204206
hook := newTracingHook(
205207
"",
206208
WithTracerProvider(provider),
209+
WithCommandFilter(BasicCommandFilter),
207210
)
208211
ctx, span := provider.Tracer("redis-test").Start(context.TODO(), "redis-test")
209212
cmd := redis.NewCmd(ctx, "hello", 3)

0 commit comments

Comments
 (0)