Skip to content

Commit 4ebc42c

Browse files
karakayasemiSemih Serhat Karakaya
authored and
Semih Serhat Karakaya
committed
[processor/redaction] use AsString() instead of Str() to get string value (open-telemetry#37239)
1 parent 0e184c8 commit 4ebc42c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

processor/redactionprocessor/processor.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (s *redaction) processLogBody(ctx context.Context, body pcommon.Value, attr
181181
s.redactLogBodyRecursive(ctx, fmt.Sprintf("[%d]", i), body.Slice().At(i), &redactedKeys, &maskedKeys, &allowedKeys, &ignoredKeys)
182182
}
183183
default:
184-
strVal := body.Str()
184+
strVal := body.AsString()
185185
if s.shouldAllowValue(strVal) {
186186
allowedKeys = append(allowedKeys, "body")
187187
return
@@ -228,10 +228,11 @@ func (s *redaction) redactLogBodyRecursive(ctx context.Context, key string, valu
228228
}
229229
case pcommon.ValueTypeSlice:
230230
for i := 0; i < value.Slice().Len(); i++ {
231-
s.redactLogBodyRecursive(ctx, fmt.Sprintf("%s.[%d]", key, i), value.Slice().At(i), redactedKeys, maskedKeys, allowedKeys, ignoredKeys)
231+
keyWithPath := fmt.Sprintf("%s.[%d]", key, i)
232+
s.redactLogBodyRecursive(ctx, keyWithPath, value.Slice().At(i), redactedKeys, maskedKeys, allowedKeys, ignoredKeys)
232233
}
233234
default:
234-
strVal := value.Str()
235+
strVal := value.AsString()
235236
if s.shouldAllowValue(strVal) {
236237
*allowedKeys = append(*allowedKeys, key)
237238
return

0 commit comments

Comments
 (0)