Skip to content

Commit

Permalink
Additional comments on ID methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bboreham committed May 18, 2021
1 parent 4c3e012 commit 7b3b275
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions controllers/events/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (r *EventWatcher) createTraceFromTopLevelObject(ctx context.Context, obj ru
return spanData, nil
}

// create a spanID that will be consistent for a particular object
func objectToSpanID(m v1.Object) trace.SpanID {
f := fnv.New64a()
_, _ = f.Write([]byte(m.GetUID()))
Expand All @@ -104,6 +105,7 @@ func objectToSpanID(m v1.Object) trace.SpanID {
return h
}

// we include the generation, so changes to the spec will start a new trace.
func objectToTraceID(m v1.Object) trace.TraceID {
f := fnv.New128a()
_, _ = f.Write([]byte(m.GetUID()))
Expand Down

0 comments on commit 7b3b275

Please sign in to comment.