Class SetupAndExecuteCanariesStage

  • All Implemented Interfaces:
    com.netflix.spinnaker.kork.plugins.api.internal.SpinnakerExtensionPoint, com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder, org.pf4j.ExtensionPoint

    @Component
    public class SetupAndExecuteCanariesStage
    extends java.lang.Object
    implements com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder
    This StageExecution setups up the canary execution stages and executes / monitors them. This StageExecution will trigger the GenerateCanaryAnalysisResultStage always.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder

        com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder.Aliases
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String STAGE_DESCRIPTION  
      static java.lang.String STAGE_TYPE  
    • Constructor Summary

      Constructors 
      Constructor Description
      SetupAndExecuteCanariesStage​(java.time.Clock clock, com.fasterxml.jackson.databind.ObjectMapper kayentaObjectMapper)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterStages​(com.netflix.spinnaker.orca.api.pipeline.models.StageExecution parent, com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder graph)  
      void beforeStages​(com.netflix.spinnaker.orca.api.pipeline.models.StageExecution parent, com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder graph)  
      protected java.util.Map<java.lang.String,​com.netflix.kayenta.canary.CanaryScopePair> buildRequestScopes​(CanaryAnalysisExecutionRequest config, long interval, java.time.Duration intervalDuration)  
      protected java.time.Duration calculateAnalysisInterval​(CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest, java.time.Duration lifetime)
      Calculates the how often a canary judgement should be performed during the lifetime of the canary analysis execution.
      protected java.time.Duration calculateLifetime​(java.time.Instant start, java.time.Instant endTime, CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest)
      Calculates the lifetime duration for the canary analysis execution.
      protected com.netflix.kayenta.standalonecanaryanalysis.orca.stage.SetupAndExecuteCanariesStage.ScopeTimeConfig calculateStartAndEndForJudgement​(CanaryAnalysisExecutionRequest config, long judgementNumber, java.time.Duration judgementDuration)
      Calculates the start and end timestamps that will be used when querying the metrics sources when doing the canary judgements for each judgement interval.
      java.lang.String getType()  
      void onFailureStages​(com.netflix.spinnaker.orca.api.pipeline.models.StageExecution parent, com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder graph)  
      void taskGraph​(com.netflix.spinnaker.orca.api.pipeline.models.StageExecution stage, com.netflix.spinnaker.orca.api.pipeline.graph.TaskNode.Builder builder)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.netflix.spinnaker.kork.plugins.api.internal.SpinnakerExtensionPoint

        getExtensionClass, getPluginId
      • Methods inherited from interface com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder

        aliases, buildTaskGraph, canManuallySkip, prepareStageForRestart
    • Constructor Detail

      • SetupAndExecuteCanariesStage

        @Autowired
        public SetupAndExecuteCanariesStage​(java.time.Clock clock,
                                            com.fasterxml.jackson.databind.ObjectMapper kayentaObjectMapper)
    • Method Detail

      • taskGraph

        public void taskGraph​(@Nonnull
                              com.netflix.spinnaker.orca.api.pipeline.models.StageExecution stage,
                              @Nonnull
                              com.netflix.spinnaker.orca.api.pipeline.graph.TaskNode.Builder builder)
        Specified by:
        taskGraph in interface com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder
      • beforeStages

        public void beforeStages​(@Nonnull
                                 com.netflix.spinnaker.orca.api.pipeline.models.StageExecution parent,
                                 @Nonnull
                                 com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder graph)
        Specified by:
        beforeStages in interface com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder
      • calculateLifetime

        protected java.time.Duration calculateLifetime​(java.time.Instant start,
                                                       java.time.Instant endTime,
                                                       CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest)
        Calculates the lifetime duration for the canary analysis execution.
        Parameters:
        start - The calculated start time for the execution
        endTime - The calculated endtime
        canaryAnalysisExecutionRequest - The execution request
        Returns:
        The calculated duration of the canary analysis
      • calculateAnalysisInterval

        protected java.time.Duration calculateAnalysisInterval​(CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest,
                                                               java.time.Duration lifetime)
        Calculates the how often a canary judgement should be performed during the lifetime of the canary analysis execution.
        Parameters:
        canaryAnalysisExecutionRequest - The execution requests
        lifetime - The calculated lifetime of the canary analysis execution
        Returns:
        How often a judgement should be performed
      • buildRequestScopes

        protected java.util.Map<java.lang.String,​com.netflix.kayenta.canary.CanaryScopePair> buildRequestScopes​(CanaryAnalysisExecutionRequest config,
                                                                                                                      long interval,
                                                                                                                      java.time.Duration intervalDuration)
      • calculateStartAndEndForJudgement

        protected com.netflix.kayenta.standalonecanaryanalysis.orca.stage.SetupAndExecuteCanariesStage.ScopeTimeConfig calculateStartAndEndForJudgement​(CanaryAnalysisExecutionRequest config,
                                                                                                                                                        long judgementNumber,
                                                                                                                                                        java.time.Duration judgementDuration)
        Calculates the start and end timestamps that will be used when querying the metrics sources when doing the canary judgements for each judgement interval.
        Parameters:
        judgementNumber - The judgement number / index for the canary analysis execution
        judgementDuration - The duration of the judgement window
        config - The execution request config
        Returns:
        A wrapper object containing the start and end times to be used as Instants
      • onFailureStages

        public void onFailureStages​(@Nonnull
                                    com.netflix.spinnaker.orca.api.pipeline.models.StageExecution parent,
                                    @Nonnull
                                    com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder graph)
        Specified by:
        onFailureStages in interface com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder
      • afterStages

        public void afterStages​(@Nonnull
                                com.netflix.spinnaker.orca.api.pipeline.models.StageExecution parent,
                                @Nonnull
                                com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder graph)
        Specified by:
        afterStages in interface com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder
      • getType

        @Nonnull
        public java.lang.String getType()
        Specified by:
        getType in interface com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder