Skip to content

Commit

Permalink
normalize metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
smithclay committed Jun 13, 2024
1 parent 21f0271 commit c8deb93
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion collector/components/servicenowexporter/servicenow.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,17 @@ func (e *serviceNowProducer) writeNumberDataPoints(metricName string, scope stri
func ci2metricAttrs(rAttrs pcommon.Map) map[string]string {
attrs := make(map[string]string)
rAttrs.Range(func(k string, v pcommon.Value) bool {
attrs[k] = v.AsString()
if v.Type() == pcommon.ValueTypeStr {
attrs[k] = v.AsString()
}
if v.Type() == pcommon.ValueTypeMap {
v.Map().Range(func(k2 string, v2 pcommon.Value) bool {
if v2.Type() == pcommon.ValueTypeStr {
attrs[k+"."+k2] = v2.AsString()
}
return true
})
}
return true
})
return attrs
Expand Down Expand Up @@ -347,6 +357,9 @@ func buildPath(name string, attributes pcommon.Map) string {

buf.WriteString(name)
attributes.Range(func(k string, v pcommon.Value) bool {
if v.Type() != pcommon.ValueTypeStr {
return true
}
value := v.AsString()
if value == "" {
value = tagValueEmptyPlaceholder
Expand Down

0 comments on commit c8deb93

Please sign in to comment.