Package com.wavefront.agent.preprocessor
Class PreprocessorUtil
- java.lang.Object
-
- com.wavefront.agent.preprocessor.PreprocessorUtil
-
public abstract class PreprocessorUtil extends Object
Utility class for methods used by preprocessors.- Author:
- [email protected]
-
-
Field Summary
Fields Modifier and Type Field Description static String[]
LOGICAL_OPS
static String
V2_PREDICATE_KEY
-
Constructor Summary
Constructors Constructor Description PreprocessorUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
expandPlaceholders(String input, wavefront.report.ReportPoint reportPoint)
Substitute {{...}} placeholders with corresponding components of the point {{metricName}} {{sourceName}} are replaced with the metric name and source respectively {{anyTagK}} is replaced with the value of the anyTagK point tagstatic String
expandPlaceholders(String input, wavefront.report.Span span)
Substitute {{...}} placeholders with corresponding components of a Span {{spanName}} {{sourceName}} are replaced with the span name and source respectively {{anyKey}} is replaced with the value of an annotation with anyKey keystatic boolean
getBoolean(Map<String,Object> ruleMap, String key, boolean defaultValue)
static int
getInteger(Map<String,Object> ruleMap, String key, int defaultValue)
static Predicate
getPredicate(Map<String,Object> ruleMap, String key, Class<?> reportableEntity)
static String
getReportableEntityComparableValue(String scope, wavefront.report.ReportPoint point)
static List<String>
getReportableEntityComparableValue(String scope, wavefront.report.Span span)
static String
getString(Map<String,Object> ruleMap, String key)
static Predicate
parsePredicate(Map<String,Object> v2Predicate, Class<?> reportableEntity)
Parses the entire v2 Predicate tree into a Predicate.static Predicate
processLogicalOp(Map<String,Object> element, Class<?> reportableEntity)
static String
truncate(String input, int maxLength, LengthLimitActionType actionSubtype)
Enforce string max length limit - either truncate or truncate with "..." at the end.
-
-
-
Field Detail
-
LOGICAL_OPS
public static final String[] LOGICAL_OPS
-
V2_PREDICATE_KEY
public static final String V2_PREDICATE_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
expandPlaceholders
public static String expandPlaceholders(String input, @Nonnull wavefront.report.ReportPoint reportPoint)
Substitute {{...}} placeholders with corresponding components of the point {{metricName}} {{sourceName}} are replaced with the metric name and source respectively {{anyTagK}} is replaced with the value of the anyTagK point tag- Parameters:
input
- input string with {{...}} placeholdersreportPoint
- ReportPoint object to extract components from- Returns:
- string with substituted placeholders
-
expandPlaceholders
public static String expandPlaceholders(String input, @Nonnull wavefront.report.Span span)
Substitute {{...}} placeholders with corresponding components of a Span {{spanName}} {{sourceName}} are replaced with the span name and source respectively {{anyKey}} is replaced with the value of an annotation with anyKey key- Parameters:
input
- input string with {{...}} placeholdersspan
- Span object to extract components from- Returns:
- string with substituted placeholders
-
truncate
public static String truncate(String input, int maxLength, LengthLimitActionType actionSubtype)
Enforce string max length limit - either truncate or truncate with "..." at the end.- Parameters:
input
- Input string to truncate.maxLength
- Truncate string at this length.actionSubtype
- TRUNCATE or TRUNCATE_WITH_ELLIPSIS.- Returns:
- truncated string
-
getBoolean
public static boolean getBoolean(Map<String,Object> ruleMap, String key, boolean defaultValue)
-
getPredicate
@Nullable public static Predicate getPredicate(Map<String,Object> ruleMap, String key, Class<?> reportableEntity)
-
parsePredicate
public static Predicate parsePredicate(Map<String,Object> v2Predicate, Class<?> reportableEntity)
Parses the entire v2 Predicate tree into a Predicate.- Parameters:
v2Predicate
- the predicate treereportableEntity
-- Returns:
- Predicate
-
processLogicalOp
public static Predicate processLogicalOp(Map<String,Object> element, Class<?> reportableEntity)
-
getReportableEntityComparableValue
public static String getReportableEntityComparableValue(String scope, wavefront.report.ReportPoint point)
-
-