-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zipkin span start time and duration sanitizer #333
Zipkin span start time and duration sanitizer #333
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nits
if anno.Value == zc.CLIENT_SEND { | ||
span.Timestamp = &anno.Timestamp | ||
return span | ||
} else if anno.Value == zc.SERVER_RECV && span.ParentID == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else
is redundant since previous if ends with return
span.Timestamp = &anno.Timestamp | ||
return span | ||
} else if anno.Value == zc.SERVER_RECV && span.ParentID == nil { | ||
span.Timestamp = &anno.Timestamp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment explaining why not breaking out of loop in this case?
} | ||
if first != last { | ||
duration := last - first | ||
span.Duration = &duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double allocation with L85 - better to declare local var duration
and do span.Duration = &duration
at the end of if
last = anno.Timestamp | ||
} | ||
} | ||
if first != last { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe first < last
? Otherwise you can assign negative TS
44c6dd5
to
675c709
Compare
@yurishkuro thanks for the quick look. PR updated |
close/open to trigger travis build. |
Similar to: https://github.com/openzipkin/zipkin/blob/master/zipkin/src/main/java/zipkin/internal/ApplyTimestampAndDuration.java
This is required for follow-up PR with zipkin JSON encoding.