Synthesise Events from Condition transitions #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Many objects have Conditions, like these on a Deployment:
We can create additional spans from the time these conditions are updated. Current code in this PR just creates zero-length spans same as we get with Events, but even better if we could put the start and end time of the span at the points where the transition goes to False then to True.
It works by starting a
Watch()on any object we received an Event from, or anything in its owner chain, to see Conditions change over time.Still to do: drop the watch on objects that haven't done anything in a while.
We adjust timestamps from condition transitions that have arrived promptly, the same as we do for Events, to give a more fine-grained display in tracing.
Note the "Events" that are synthesised are just used as a convenient internal object to turn into spans; they aren't meant to look like real Events. For instance the ObjectMeta is populated with info useful for debugging.
The unit test for this feature builds on the capture/playback mechanism added in #32.
Example, from Cluster-API:
