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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)))
}
}