fix the event attributes (#54117)

This commit is contained in:
ying-jeanne
2022-08-24 09:59:06 -05:00
committed by GitHub
parent 9be8b0564a
commit 4d4ecd7fec

View File

@@ -270,10 +270,10 @@ func (s OpentelemetrySpan) RecordError(err error, options ...trace.EventOption)
func (s OpentelemetrySpan) AddEvents(keys []string, values []EventValue) {
for i, v := range values {
if v.Num != 0 {
if v.Str != "" {
s.span.AddEvent(keys[i], trace.WithAttributes(attribute.Key(keys[i]).String(v.Str)))
}
if v.Str != "" {
if v.Num != 0 {
s.span.AddEvent(keys[i], trace.WithAttributes(attribute.Key(keys[i]).Int64(v.Num)))
}
}