Skip to content

Commit

Permalink
Update otlptext
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax committed Sep 27, 2024
1 parent a1c9978 commit 44e128c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 15 additions & 0 deletions exporter/internal/otlptext/databuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,21 @@ func (b *dataBuffer) logExemplars(description string, se pmetric.ExemplarSlice)
}
}

func (b *dataBuffer) logResourceEntities(rers pcommon.ResourceEntityRefSlice) {
if rers.Len() == 0 {
return
}

b.logEntry("Entities:")
for i := 0; i < rers.Len(); i++ {
rer := rers.At(i)
b.logEntry("Entity Ref #%d", i)
b.logEntry(" -> Entity Type: %s", rer.Type())
b.logEntry(" -> Identifying Attributes: %s", strings.Join(rer.IdAttrKeys().AsRaw(), ", "))
b.logEntry(" -> Descriptive Attributes: %s", strings.Join(rer.DescrAttrKeys().AsRaw(), ", "))
}
}

func valueToString(v pcommon.Value) string {
return fmt.Sprintf("%s(%s)", v.Type().String(), v.AsString())
}
3 changes: 1 addition & 2 deletions exporter/internal/otlptext/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ import (

func marshalResource(res pcommon.Resource, buf *dataBuffer) {
buf.logAttributes("Resource attributes", res.Attributes())
buf.logEntry("Entity Type: %s", res.EntityType())
buf.logAttributes("Entity Id", res.EntityId())
buf.logResourceEntities(res.Entities())
}

0 comments on commit 44e128c

Please sign in to comment.