-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pipelines): Fixed interpretation of missing startTime during inst… (
#2820) * fix(pipelines): Fixed interpretation of missing startTime during instrumentation Fixes spinnaker/spinnaker#4244 There are conditions in which CompleteStageHandler can be called without having a startTime set. Often this is because an exception was thrown before the startTime was set, but there are various guards within StartStageHandler as well. Previously when this happened, a StartTime of 0 was used. This is particularly bad because the 40-years worth of nanoseconds that is spit out of spectator is beyond the resolution of "double" for metric stores that use double for time. This fix changes the assumption to be the end time, resulting in assuming 0 time. Not that this could possibly be a different type of issue if the underlying problem was something else, such as StartStageHandler not even being called for some reason. In addition I set the startTime at the beginning of the try block where exceptions may be thrown in order to ensure there is a startTime when going through that control flow. I think this might be messy depending on how time and state are used because it has a startTime but is not in the RUNNING state. There does not seem to be an appropriate state definition for this particular phase and am not sure the implications of adding one. I also dont know if moving the startTime so it includes this extra check has other implications. If so then the startTime could be reset where it is currently set. * defer RUNNING status until after the extra initial store. Being in the RUNNING state affected the handler guard checking for NOT_STARTED (line 71) causing it to be ignored. I dont really understand the control flow here, and could not follow along in a debugger because kotlin/mockito jumps all over the place making it impossible for me to grok that way. I suspect there is a better fix and could involve adding another status between NOT_STARTED and RUNNING but that is beyond my level of intimacy with the model here. fixed tests to accomodate the second storeStage call.
- Loading branch information
1 parent
72b08f2
commit e872ce8
Showing
3 changed files
with
25 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters