Skip to content

Commit

Permalink
Convert ValueTypeBytes attributes in logging exporter
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan <[email protected]>
  • Loading branch information
bogdandrutu committed Sep 27, 2022
1 parent 44ce8e3 commit bc337b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions exporter/loggingexporter/internal/otlptext/databuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package otlptext // import "go.opentelemetry.io/collector/exporter/loggingexport

import (
"bytes"
"encoding/base64"
"fmt"
"math"
"strconv"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit bc337b3

Please sign in to comment.