Skip to content

Commit

Permalink
Warn about time adjustment in tags
Browse files Browse the repository at this point in the history
Time adjustment is confused to many people, as you can see in jaegertracing#961.

This change adds a warning in tags if we do any time adjustments,
so that it's at least clear that adjustments happened.
  • Loading branch information
bobrik committed Feb 2, 2020
1 parent 7d339ef commit 6003a87
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions model/adjuster/clockskew.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,14 @@ func (a *clockSkewAdjuster) calculateSkew(child *node, parent *node) time.Durati
}

func (a *clockSkewAdjuster) adjustTimestamps(n *node, skew clockSkew) {
if skew.delta == 0 {
return
}

n.span.StartTime = n.span.StartTime.Add(skew.delta)
n.span.Tags = append(n.span.Tags, model.String("time.adjustment.warning", fmt.Sprintf("Warning: this span's timestamps were adjusted by %v", skew.delta)))
n.span.Tags = append(n.span.Tags, model.String("time.adjustment.url", "https://github.com/jaegertracing/jaeger/issues/961"))

for i := range n.span.Logs {
n.span.Logs[i].Timestamp = n.span.Logs[i].Timestamp.Add(skew.delta)
}
Expand Down

0 comments on commit 6003a87

Please sign in to comment.