diff --git a/CHANGELOG.md b/CHANGELOG.md index 45154704f1f..bd5eed21c71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - Add AppendEmpty and EnsureCapacity method to primitive pdata slices (#6060) - Expose `AsRaw` and `FromRaw` `pcommon.Value` methods (#6090) +- Convert `ValueTypeBytes` attributes in logging exporter (#6153) ## v0.60.0 Beta diff --git a/exporter/loggingexporter/internal/otlptext/databuffer.go b/exporter/loggingexporter/internal/otlptext/databuffer.go index 162174024b5..be3ff686702 100644 --- a/exporter/loggingexporter/internal/otlptext/databuffer.go +++ b/exporter/loggingexporter/internal/otlptext/databuffer.go @@ -16,6 +16,7 @@ package otlptext // import "go.opentelemetry.io/collector/exporter/loggingexport import ( "bytes" + "encoding/base64" "fmt" "math" "strconv" @@ -280,6 +281,8 @@ func attributeValueToString(v pcommon.Value) string { return strconv.FormatFloat(v.DoubleVal(), 'f', -1, 64) case pcommon.ValueTypeInt: return strconv.FormatInt(v.IntVal(), 10) + case pcommon.ValueTypeBytes: + return base64.StdEncoding.EncodeToString(v.BytesVal().AsRaw()) case pcommon.ValueTypeSlice: return sliceToString(v.SliceVal()) case pcommon.ValueTypeMap: