Skip to content

Commit

Permalink
feat: support all types of attributes (#14)
Browse files Browse the repository at this point in the history
* feat: support all types of attributes

* feat: handle all tag types for resource attributes
  • Loading branch information
makeavish authored Sep 13, 2022
1 parent 57eaced commit d582399
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions exporter/clickhousetracesexporter/clickhouse_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,7 @@ func populateEvents(events ptrace.SpanEventSlice, span *Span) {
event.AttributeMap = map[string]string{}
event.IsError = false
events.At(i).Attributes().Range(func(k string, v pcommon.Value) bool {
if v.Type().String() == "INT" {
event.AttributeMap[k] = strconv.FormatInt(v.IntVal(), 10)
} else {
event.AttributeMap[k] = v.StringVal()
}
event.AttributeMap[k] = v.AsString()
return true
})
if event.Name == "exception" {
Expand Down Expand Up @@ -231,23 +227,13 @@ func newStructuredSpan(otelSpan ptrace.Span, ServiceName string, resource pcommo
tagMap := map[string]string{}

attributes.Range(func(k string, v pcommon.Value) bool {
v.StringVal()
if v.Type().String() == "INT" {
tagMap[k] = strconv.FormatInt(v.IntVal(), 10)
} else if v.StringVal() != "" {
tagMap[k] = v.StringVal()
}
tagMap[k] = v.AsString()
return true

})

resourceAttributes.Range(func(k string, v pcommon.Value) bool {
v.StringVal()
if v.Type().String() == "INT" {
tagMap[k] = strconv.FormatInt(v.IntVal(), 10)
} else if v.StringVal() != "" {
tagMap[k] = v.StringVal()
}
tagMap[k] = v.AsString()
return true

})
Expand Down

0 comments on commit d582399

Please sign in to comment.