private CanaryScope getScopeForNamedScope(CanaryExecutionRequest executionRequest, String scopeName, boolean isCanary) { CanaryScopePair canaryScopePair = executionRequest.getScopes().get(scopeName); CanaryScope canaryScope = isCanary ? canaryScopePair.getExperimentScope() : canaryScopePair.getControlScope(); if (canaryScope == null) { throw new IllegalArgumentException("Canary scope for named scope " + scopeName + " is missing experimentScope or controlScope keys"); } return canaryScope; }
protected Map<String, CanaryScopePair> buildRequestScopes(CanaryAnalysisExecutionRequest config, long interval, Duration intervalDuration) { Map<String, CanaryScopePair> scopes = new HashMap<>(); config.getScopes().forEach(scope -> { ScopeTimeConfig scopeTimeConfig = calculateStartAndEndForJudgement(config, interval, intervalDuration); CanaryScope controlScope = new CanaryScope( scope.getControlScope(), scope.getControlLocation(), scopeTimeConfig.start, scopeTimeConfig.end, config.getStep().getSeconds(), scope.getExtendedScopeParams() ); CanaryScope experimentScope = new CanaryScope( scope.getExperimentScope(), scope.getExperimentLocation(), scopeTimeConfig.start, scopeTimeConfig.end, config.getStep().getSeconds(), scope.getExtendedScopeParams() ); CanaryScopePair canaryScopePair = new CanaryScopePair() .setControlScope(controlScope) .setExperimentScope(experimentScope); scopes.put(scope.getScopeName(), canaryScopePair); }); return scopes; }
"judgementStartTimeIso", firstScopePair.getControlScope().getStart().toString(), "judgementStartTimeMillis", firstScopePair.getControlScope().getStart().toEpochMilli(), "judgementEndTimeIso", firstScopePair.getControlScope().getEnd().toString(), "judgementEndTimeMillis", firstScopePair.getControlScope().getEnd().toEpochMilli() ));
"judgementStartTimeIso", firstScopePair.getControlScope().getStart().toString(), "judgementStartTimeMillis", firstScopePair.getControlScope().getStart().toEpochMilli(), "judgementEndTimeIso", firstScopePair.getControlScope().getEnd().toString(), "judgementEndTimeMillis", firstScopePair.getControlScope().getEnd().toEpochMilli() ));
private CanaryScope getScopeForNamedScope(CanaryExecutionRequest executionRequest, String scopeName, boolean isCanary) { CanaryScopePair canaryScopePair = executionRequest.getScopes().get(scopeName); CanaryScope canaryScope = isCanary ? canaryScopePair.getExperimentScope() : canaryScopePair.getControlScope(); if (canaryScope == null) { throw new IllegalArgumentException("Canary scope for named scope " + scopeName + " is missing experimentScope or controlScope keys"); } return canaryScope; }
protected Map<String, CanaryScopePair> buildRequestScopes(CanaryAnalysisExecutionRequest config, long interval, Duration intervalDuration) { Map<String, CanaryScopePair> scopes = new HashMap<>(); config.getScopes().forEach(scope -> { ScopeTimeConfig scopeTimeConfig = calculateStartAndEndForJudgement(config, interval, intervalDuration); CanaryScope controlScope = new CanaryScope( scope.getControlScope(), scope.getControlLocation(), scopeTimeConfig.start, scopeTimeConfig.end, config.getStep().getSeconds(), scope.getExtendedScopeParams() ); CanaryScope experimentScope = new CanaryScope( scope.getExperimentScope(), scope.getExperimentLocation(), scopeTimeConfig.start, scopeTimeConfig.end, config.getStep().getSeconds(), scope.getExtendedScopeParams() ); CanaryScopePair canaryScopePair = new CanaryScopePair() .setControlScope(controlScope) .setExperimentScope(experimentScope); scopes.put(scope.getScopeName(), canaryScopePair); }); return scopes; }