Class SetupAndExecuteCanariesStage

java.lang.Object
com.netflix.kayenta.standalonecanaryanalysis.orca.stage.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 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 final String
     
    static final String
     
  • Constructor Summary

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

    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 Map<String,com.netflix.kayenta.canary.CanaryScopePair>
    buildRequestScopes(CanaryAnalysisExecutionRequest config, long interval, Duration intervalDuration)
     
    protected Duration
    calculateAnalysisInterval(CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest, Duration lifetime)
    Calculates the how often a canary judgement should be performed during the lifetime of the canary analysis execution.
    protected Duration
    calculateLifetime(Instant start, 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, 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.
     
    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
  • Field Details

  • Constructor Details

    • SetupAndExecuteCanariesStage

      @Autowired public SetupAndExecuteCanariesStage(Clock clock, com.fasterxml.jackson.databind.ObjectMapper kayentaObjectMapper)
  • Method Details

    • 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 Duration calculateLifetime(Instant start, 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 Duration calculateAnalysisInterval(CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest, 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 Map<String,com.netflix.kayenta.canary.CanaryScopePair> buildRequestScopes(CanaryAnalysisExecutionRequest config, long interval, Duration intervalDuration)
    • calculateStartAndEndForJudgement

      protected com.netflix.kayenta.standalonecanaryanalysis.orca.stage.SetupAndExecuteCanariesStage.ScopeTimeConfig calculateStartAndEndForJudgement(CanaryAnalysisExecutionRequest config, long judgementNumber, 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 String getType()
      Specified by:
      getType in interface com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder