Skip to content

Commit 3358687

Browse files
committed
Support string slice.
1 parent 55ca35b commit 3358687

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

go/internal/otel/custom_sampler.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,21 @@ func matchAttributeValue(v attribute.Value, matchValue interface{}) bool {
384384
}
385385
}
386386
return true
387+
case attribute.STRINGSLICE:
388+
asStringSlice, ok := matchValue.([]string)
389+
if !ok {
390+
return false
391+
}
392+
lenMatch := len(asStringSlice) == len(v.AsStringSlice())
393+
if !lenMatch {
394+
return false
395+
}
396+
for i := range asStringSlice {
397+
if asStringSlice[i] != v.AsStringSlice()[i] {
398+
return false
399+
}
400+
}
401+
return true
387402
default:
388403
return false
389404
}

0 commit comments

Comments
 (0)