Skip to content

Commit

Permalink
refactor(core): move standalone canary analysis domain models back in…
Browse files Browse the repository at this point in the history
…to it's module (#742)

Co-authored-by: Justin Field <justin.field@armory.io>
  • Loading branch information
Anastasiia Smirnova and fieldju committed Jun 24, 2020
1 parent c374d49 commit c2d7251
Show file tree
Hide file tree
Showing 21 changed files with 77 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.netflix.kayenta.canary.CanaryConfig;
import com.netflix.kayenta.canary.CanaryExecutionStatusResponse;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.metrics.MetricSet;
import com.netflix.kayenta.metrics.MetricSetPair;
import java.util.List;
Expand All @@ -44,12 +43,6 @@ public interface ObjectType {
new StandardObjectType(
new TypeReference<List<MetricSetPair>>() {}, "metric_pairs", "metric_set_pairs.json");

ObjectType STANDALONE_CANARY_RESULT_ARCHIVE =
new StandardObjectType(
new TypeReference<CanaryAnalysisExecutionStatusResponse>() {},
"standalone_canary_archive",
"standalone_canary_archive.json");

TypeReference<?> getTypeReference();

String getGroup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import com.google.common.collect.ImmutableMap;
import com.netflix.kayenta.canary.CanaryClassifierThresholdsConfig;
import com.netflix.kayenta.canary.CanaryConfig;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisAdhocExecutionRequest;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequestScope;
import com.netflix.kayenta.metrics.CanaryAnalysisCasesConfigurationProperties;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisAdhocExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequestScope;
import com.netflix.kayenta.utils.CanaryConfigReader;
import io.restassured.response.ValidatableResponse;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.netflix.kayenta.canary.CanaryClassifierThresholdsConfig;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisAdhocExecutionRequest;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequestScope;
import com.netflix.kayenta.domain.standalonecanaryanalysis.StageMetadata;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisAdhocExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequestScope;
import com.netflix.kayenta.standalonecanaryanalysis.domain.StageMetadata;
import io.restassured.response.ValidatableResponse;
import lombok.extern.slf4j.Slf4j;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.netflix.kayenta.standalonecanaryanalysis;

import com.netflix.kayenta.canary.CanaryConfig;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequest;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

import com.netflix.kayenta.canary.CanaryConfig;
import com.netflix.kayenta.canary.providers.metrics.QueryConfigUtils;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisAdhocExecutionRequest;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionResponse;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.security.AccountCredentials;
import com.netflix.kayenta.security.AccountCredentialsRepository;
import com.netflix.kayenta.standalonecanaryanalysis.CanaryAnalysisConfig;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisAdhocExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionResponse;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.standalonecanaryanalysis.service.CanaryAnalysisService;
import com.netflix.kayenta.storage.ObjectType;
import com.netflix.kayenta.storage.StorageService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.netflix.kayenta.domain.standalonecanaryanalysis;
package com.netflix.kayenta.standalonecanaryanalysis.domain;

import com.netflix.kayenta.canary.CanaryConfig;
import io.swagger.annotations.ApiModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.netflix.kayenta.domain.standalonecanaryanalysis;
package com.netflix.kayenta.standalonecanaryanalysis.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.netflix.kayenta.canary.CanaryClassifierThresholdsConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.netflix.kayenta.domain.standalonecanaryanalysis;
package com.netflix.kayenta.standalonecanaryanalysis.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.netflix.kayenta.domain.standalonecanaryanalysis;
package com.netflix.kayenta.standalonecanaryanalysis.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.netflix.kayenta.domain.standalonecanaryanalysis;
package com.netflix.kayenta.standalonecanaryanalysis.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.netflix.kayenta.domain.standalonecanaryanalysis;
package com.netflix.kayenta.standalonecanaryanalysis.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.netflix.kayenta.canary.CanaryConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.netflix.kayenta.domain.standalonecanaryanalysis;
package com.netflix.kayenta.standalonecanaryanalysis.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.netflix.kayenta.canary.results.CanaryResult;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 Nike, inc.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.netflix.kayenta.domain.standalonecanaryanalysis;
package com.netflix.kayenta.standalonecanaryanalysis.domain;

import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus;
import io.swagger.annotations.ApiModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.netflix.kayenta.standalonecanaryanalysis.event;

import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionStatusResponse;
import org.springframework.context.ApplicationEvent;

public class StandaloneCanaryAnalysisExecutionCompletedEvent extends ApplicationEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package com.netflix.kayenta.standalonecanaryanalysis.event;

import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.events.AbstractExecutionCompleteEventProcessor;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.standalonecanaryanalysis.service.CanaryAnalysisService;
import com.netflix.spinnaker.orca.api.pipeline.models.PipelineExecution;
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.netflix.kayenta.security.AccountCredentials;
import com.netflix.kayenta.security.AccountCredentialsRepository;
import com.netflix.kayenta.standalonecanaryanalysis.event.StandaloneCanaryAnalysisExecutionCompletedEvent;
import com.netflix.kayenta.storage.ObjectType;
import com.netflix.kayenta.standalonecanaryanalysis.storage.StandaloneCanaryAnalysisObjectType;
import com.netflix.kayenta.storage.StorageServiceRepository;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -44,7 +44,7 @@ public void onApplicationEvent(StandaloneCanaryAnalysisExecutionCompletedEvent e

storageService.storeObject(
resolvedStorageAccountName,
ObjectType.STANDALONE_CANARY_RESULT_ARCHIVE,
StandaloneCanaryAnalysisObjectType.STANDALONE_CANARY_RESULT_ARCHIVE,
response.getPipelineId(),
response);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.kayenta.canary.CanaryScope;
import com.netflix.kayenta.canary.CanaryScopePair;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.CanaryAnalysisConfig;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.orca.RunCanaryContext;
import com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder;
import com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.kayenta.canary.CanaryExecutionStatusResponse;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionResult;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryExecutionResult;
import com.netflix.kayenta.standalonecanaryanalysis.CanaryAnalysisConfig;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionResult;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryExecutionResult;
import com.netflix.kayenta.standalonecanaryanalysis.orca.stage.RunCanaryStage;
import com.netflix.spinnaker.orca.api.pipeline.Task;
import com.netflix.spinnaker.orca.api.pipeline.TaskResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionResponse;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionResult;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.domain.standalonecanaryanalysis.StageMetadata;
import com.netflix.kayenta.security.AccountCredentials;
import com.netflix.kayenta.security.AccountCredentialsRepository;
import com.netflix.kayenta.standalonecanaryanalysis.CanaryAnalysisConfig;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionResponse;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionResult;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.standalonecanaryanalysis.domain.StageMetadata;
import com.netflix.kayenta.standalonecanaryanalysis.orca.MonitorKayentaCanaryContext;
import com.netflix.kayenta.standalonecanaryanalysis.orca.stage.GenerateCanaryAnalysisResultStage;
import com.netflix.kayenta.standalonecanaryanalysis.orca.stage.SetupAndExecuteCanariesStage;
import com.netflix.kayenta.storage.ObjectType;
import com.netflix.kayenta.standalonecanaryanalysis.storage.StandaloneCanaryAnalysisObjectType;
import com.netflix.kayenta.storage.StorageService;
import com.netflix.kayenta.storage.StorageServiceRepository;
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus;
Expand Down Expand Up @@ -135,7 +135,7 @@ public CanaryAnalysisExecutionStatusResponse getCanaryAnalysisExecution(
return (CanaryAnalysisExecutionStatusResponse)
storageService.loadObject(
resolvedStorageAccountName,
ObjectType.STANDALONE_CANARY_RESULT_ARCHIVE,
StandaloneCanaryAnalysisObjectType.STANDALONE_CANARY_RESULT_ARCHIVE,
canaryAnalysisExecutionId);
})
.orElseThrow(() -> e);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2020 Playtika.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.netflix.kayenta.standalonecanaryanalysis.storage;

import com.fasterxml.jackson.core.type.TypeReference;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionStatusResponse;
import com.netflix.kayenta.storage.ObjectType;
import com.netflix.kayenta.storage.StandardObjectType;
import lombok.experimental.UtilityClass;

@UtilityClass
public class StandaloneCanaryAnalysisObjectType {

public static final ObjectType STANDALONE_CANARY_RESULT_ARCHIVE =
new StandardObjectType(
new TypeReference<CanaryAnalysisExecutionStatusResponse>() {},
"standalone_canary_archive",
"standalone_canary_archive.json");
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.domain.standalonecanaryanalysis.CanaryAnalysisExecutionRequestScope;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequest;
import com.netflix.kayenta.standalonecanaryanalysis.domain.CanaryAnalysisExecutionRequestScope;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
Expand Down

0 comments on commit c2d7251

Please sign in to comment.