public abstract class MetricMaker extends Object
| Modifier and Type | Field and Description | 
|---|---|
MetricDictionary | 
metrics
The metric dictionary from which dependent metrics will be resolved. 
 | 
static Function<String,ResultSetMapper> | 
NO_OP_MAP_PROVIDER  | 
static NoOpResultSetMapper | 
NO_OP_MAPPER  | 
| Constructor and Description | 
|---|
MetricMaker(MetricDictionary metrics)
Construct a fully specified MetricMaker. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
assertDependentMetricsExist(List<String> dependentMetrics)
Checks that the dependent metrics are in the dictionary, and throws an exception if any are not. 
 | 
protected void | 
assertRequiredDependentMetricCount(String dictionaryName,
                                  List<String> dependentMetrics)
Checks that we have the right number of metrics, and throws an exception if we don't. 
 | 
protected abstract int | 
getDependentMetricsRequired()
Get the number of dependent metrics the maker requires for making the metric. 
 | 
protected TemplateDruidQuery | 
getDependentQuery(String name)
Deprecated. 
 
Instead get the metric in the calling function and then get the TDQ out only if necessary 
 | 
protected TemplateDruidQuery | 
getMergedQuery(List<String> names)
A helper function returning the resulting aggregation set from merging one or more template druid queries. 
 | 
protected static PostAggregation | 
getNumericField(MetricField field)
Prepare a post aggregation for a field expecting a numeric value. 
 | 
protected PostAggregation | 
getNumericField(String fieldName)
Deprecated. 
 
use the static version  
getNumericField(MetricField) by preference | 
protected static PostAggregation | 
getSketchField(MetricField field)
Prepare a post aggregation for a field expecting a sketch value. 
 | 
protected PostAggregation | 
getSketchField(String fieldName)
Deprecated. 
 
use the static version  
getSketchField(MetricField) by preference | 
LogicalMetric | 
make(LogicalMetricInfo logicalMetricInfo,
    List<String> dependentMetrics)
Make the metric. 
 | 
LogicalMetric | 
make(String metricName,
    List<String> dependentMetrics)
Deprecated. 
 
logical metric needs more config-richness to not just configure metric name, but also metric long
 name, description, etc. Use  
make(LogicalMetricInfo, List) instead. | 
LogicalMetric | 
make(String metricName,
    String dependentMetric)
Make the metric. 
 | 
protected LogicalMetric | 
makeInner(LogicalMetricInfo logicalMetricInfo,
         List<String> dependentMetrics)
Delegated to for actually making the metric. 
 | 
protected LogicalMetric | 
makeInner(String metricName,
         List<String> dependentMetrics)
Deprecated. 
 
logical metric needs more config-richness to not just configure metric name, but also metric long
 name, description, etc. Use  
makeInner(LogicalMetricInfo, List) instead. | 
public static final NoOpResultSetMapper NO_OP_MAPPER
public static final Function<String,ResultSetMapper> NO_OP_MAP_PROVIDER
public final MetricDictionary metrics
public MetricMaker(MetricDictionary metrics)
metrics - A mapping of metric names to the corresponding LogicalMetrics. Used to resolve metric names
 when making the logical metric.@Deprecated public LogicalMetric make(String metricName, List<String> dependentMetrics)
make(LogicalMetricInfo, List) instead.This method also sanity-checks the dependent metrics to make sure that they are metrics we have built and are in the metric dictionary.
Also sanity-checks that the number of dependent metrics are correct for the maker.
metricName - Name for the metric we're makingdependentMetrics - Metrics this metric depends onpublic LogicalMetric make(LogicalMetricInfo logicalMetricInfo, List<String> dependentMetrics)
This method also sanity-checks the dependent metrics to make sure that they are metrics we have built and are in the metric dictionary.
Also sanity-checks that the number of dependent metrics are correct for the maker.
logicalMetricInfo - Logical metric info providerdependentMetrics - Metrics this metric depends onprotected void assertRequiredDependentMetricCount(String dictionaryName, List<String> dependentMetrics)
dictionaryName - Name of the metric being madedependentMetrics - List of dependent metrics needed to make the metricprotected void assertDependentMetricsExist(List<String> dependentMetrics)
dependentMetrics - List of dependent metrics needed to checkpublic LogicalMetric make(String metricName, String dependentMetric)
metricName - Name for the metric we're makingdependentMetric - Metric this metric depends on@Deprecated protected LogicalMetric makeInner(String metricName, List<String> dependentMetrics)
makeInner(LogicalMetricInfo, List) instead.metricName - Name for the metric we're makingdependentMetrics - Metrics this metric depends onprotected LogicalMetric makeInner(LogicalMetricInfo logicalMetricInfo, List<String> dependentMetrics)
logicalMetricInfo - Logical metric info providerdependentMetrics - Metrics this metric depends onprotected abstract int getDependentMetricsRequired()
@Deprecated protected TemplateDruidQuery getDependentQuery(String name)
name - Name of the metric to fetch the template druid query fromprotected TemplateDruidQuery getMergedQuery(List<String> names)
names - Names of the metrics to fetch and merge the aggregation clauses from@Deprecated protected PostAggregation getNumericField(String fieldName)
getNumericField(MetricField) by preferenceThe post-agg is created per the following heuristics:
fieldName - The name for the aggregation or post aggregation column being gottenprotected static PostAggregation getNumericField(MetricField field)
The post-agg is created per the following heuristics:
field - The field being coerced@Deprecated protected PostAggregation getSketchField(String fieldName)
getSketchField(MetricField) by preferenceThe post-agg is created per the following heuristics:
fieldName - The name for the aggregation or post aggregation column being gottenprotected static PostAggregation getSketchField(MetricField field)
The post-agg is created per the following heuristics:
field - The field being coercedCopyright © 2016–2018 Yahoo! Inc.. All rights reserved.