forked from linkedin/dr-elephant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved to Severity level based schema
- Loading branch information
Showing
32 changed files
with
703 additions
and
525 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
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
56 changes: 11 additions & 45 deletions
56
app/com/linkedin/drelephant/analysis/HeuristicResult.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
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,105 @@ | ||
package com.linkedin.drelephant.analysis; | ||
|
||
import com.avaje.ebean.annotation.EnumValue; | ||
|
||
public enum Severity { | ||
@EnumValue("4") | ||
CRITICAL(4, "Critical", "danger"), | ||
|
||
@EnumValue("3") | ||
SEVERE(3, "Severe", "severe"), | ||
|
||
@EnumValue("2") | ||
MODERATE(2, "Moderate", "warning"), | ||
|
||
@EnumValue("1") | ||
LOW(1, "Low", "success"), | ||
|
||
@EnumValue("0") | ||
NONE(0, "None", "success"); | ||
|
||
private int value; | ||
private String text; | ||
private String color; | ||
|
||
Severity(int value, String text, String color) { | ||
this.value = value; | ||
this.text = text; | ||
this.color = color; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public String getText() { | ||
return text; | ||
} | ||
|
||
public String getColor() { | ||
return color; | ||
} | ||
|
||
public static Severity byValue(int value) { | ||
for (Severity severity : values()) { | ||
if (severity.value == value) { | ||
return severity; | ||
} | ||
} | ||
return NONE; | ||
} | ||
|
||
public static Severity max(Severity a, Severity b) { | ||
if (a.value > b.value) { | ||
return a; | ||
} | ||
return b; | ||
} | ||
|
||
public static Severity max(Severity... severities) { | ||
Severity currentSeverity = NONE; | ||
for (Severity severity : severities) { | ||
currentSeverity = max(currentSeverity, severity); | ||
} | ||
return currentSeverity; | ||
} | ||
|
||
public static Severity min(Severity a, Severity b) { | ||
if (a.value < b.value) { | ||
return a; | ||
} | ||
return b; | ||
} | ||
|
||
public static Severity getSeverityAscending(long value, long low, long moderate, long severe, long critical) { | ||
if (value >= critical) { | ||
return CRITICAL; | ||
} | ||
if (value >= severe) { | ||
return SEVERE; | ||
} | ||
if (value >= moderate) { | ||
return MODERATE; | ||
} | ||
if (value >= low) { | ||
return LOW; | ||
} | ||
return NONE; | ||
} | ||
|
||
public static Severity getSeverityDescending(long value, long low, long moderate, long severe, long critical) { | ||
if (value <= critical) { | ||
return CRITICAL; | ||
} | ||
if (value <= severe) { | ||
return SEVERE; | ||
} | ||
if (value <= moderate) { | ||
return MODERATE; | ||
} | ||
if (value <= low) { | ||
return LOW; | ||
} | ||
return NONE; | ||
} | ||
} |
56 changes: 0 additions & 56 deletions
56
app/com/linkedin/drelephant/analysis/heuristics/GeneralMapperSlowHeuristic.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.