-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return more than a float. Add scala framework for Netflix judge.
- Loading branch information
Michael Graff
committed
Jun 28, 2017
1 parent
900deb9
commit e13bb5e
Showing
5 changed files
with
85 additions
and
13 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
41 changes: 41 additions & 0 deletions
41
kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeDummy.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2017 Google, Inc. | ||
* | ||
* 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.canary; | ||
|
||
import com.netflix.kayenta.canary.results.CanaryJudgeResult; | ||
import com.netflix.kayenta.canary.results.CanaryJudgeScore; | ||
import com.netflix.kayenta.metrics.MetricSetPair; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
import java.util.Random; | ||
|
||
@Component | ||
// TODO(duftler): Make the canary judge a pluggable component. | ||
// TODO(mgraff, or duftler): move to its own subproject once it's pluggable. | ||
public class CanaryJudgeDummy implements CanaryJudge { | ||
private Random random = new Random(); | ||
|
||
@Override | ||
public CanaryJudgeResult judge(CanaryConfig canaryConfig, List<MetricSetPair> metricSetPairList) { | ||
// TODO: "You're the judge; so judge!" | ||
|
||
CanaryJudgeScore score = CanaryJudgeScore.builder().score(random.nextDouble() * 100).build(); | ||
CanaryJudgeResult result = CanaryJudgeResult.builder().score(score).build(); | ||
return result; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
apply plugin: 'scala' | ||
|
||
dependencies { | ||
compile project(":kayenta-core") | ||
|
||
// compile spinnaker.dependency('lombok') | ||
compile "org.projectlombok:lombok:1.16.10" | ||
|
||
// scala support | ||
compile 'org.scala-lang:scala-library-all:2.12.2' | ||
compile 'org.scala-lang:scala-reflect:2.12.2' | ||
compile 'com.typesafe.scala-logging:scala-logging_2.12:3.5.0' | ||
testCompile 'org.scalatest:scalatest_2.12' | ||
} |
30 changes: 30 additions & 0 deletions
30
kayenta-judge-netflix/src/main/scala/com/netflix/kayenta/judge/netflix/NetflixJudge.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2017 Netflix, Inc. | ||
* | ||
* 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.judge.netflix | ||
|
||
import java.util | ||
|
||
import com.netflix.kayenta.canary.results.CanaryJudgeResult | ||
import com.netflix.kayenta.canary.{CanaryConfig, CanaryJudge} | ||
import com.netflix.kayenta.metrics.MetricSetPair | ||
|
||
class NetflixJudge extends CanaryJudge { | ||
override def judge(canaryConfig: CanaryConfig, metricSetPairList: util.List[MetricSetPair]): CanaryJudgeResult = { | ||
val result = CanaryJudgeResult.builder().build() | ||
result | ||
} | ||
} |