/** * Makes a copy of the metric instance with new dependencyMetricNames. * * @param dependencyMetricNames The name of metrics that this Logical Metric depends on * @return copy of the logical Metric */ public MetricInstance withDependencyMetricNames(List<String> dependencyMetricNames) { return new MetricInstance( logicalMetricInfo, maker, dependencyMetricNames.toArray(new String[dependencyMetricNames.size()]) ); }
public MetricLoader getMetricLoader() { return new TestMetricLoader(); }
@Override public void loadMetricDictionary(MetricDictionary metricDictionary, DimensionDictionary dimensionDictionary) { buildMetricMakers(metricDictionary); // Metrics that directly aggregate druid fields List<MetricInstance> metrics = Arrays.asList( new MetricInstance((ApiMetricName) A_HEIGHT, longSumMaker, HEIGHT), new MetricInstance(A_WIDTH, longSumMaker, WIDTH), new MetricInstance(A_DEPTH, longSumMaker, DEPTH), new MetricInstance(A_LIMBS, longSumMaker, LIMBS), new MetricInstance(A_USERS, sketchMaker, USERS), new MetricInstance(A_OTHER_USERS, sketchMaker, USERS), new MetricInstance(A_ROW_NUM, rowNumMaker, new FieldName[] {}), new MetricInstance(A_AREA, productMaker, A_HEIGHT, A_WIDTH), new MetricInstance(A_VOLUME, productMaker, A_HEIGHT, A_WIDTH, A_DEPTH), new MetricInstance(A_DAY_AVG_USERS, simpleDailyAverageMaker, A_USERS), new MetricInstance(A_DAY_AVG_OTHER_USERS, simpleDailyAverageMaker, A_OTHER_USERS), new MetricInstance(A_DAY_AVG_LIMBS, simpleDailyAverageMaker, A_LIMBS) ); metrics.stream().map(MetricInstance::make).forEach(metricDictionary::add); metricDictionary.getScope("shapes").add( new MetricInstance(new LogicalMetricInfo(A_SCOPED_WIDTH.asName()), longSumMaker, WIDTH.asName()).make() ); //Allows us to add some non-numeric LogicalMetrics without having to write a Maker for them. Makers should //be written if using complex metrics in production code. NonNumericMetrics.getLogicalMetrics().forEach(metricDictionary::add); } }
Collections.emptySet() ), new StringMetricMapper(), new LogicalMetricInfo( A_STRING_METRIC.getApiName(), Collections.emptySet() ), new BooleanMetricMapper(), new LogicalMetricInfo( A_BOOLEAN_METRIC.getApiName(), Collections.emptySet() ), new JsonNodeMetricMapper(), new LogicalMetricInfo( A_JSON_NODE_METRIC.getApiName(), Collections.emptySet() ), new NullMetricMapper(), new LogicalMetricInfo( A_NULL_METRIC.getApiName(),
/** * Load the Dimensions, Metrics, and Tables. */ public void load() { dimensionLoader.loadDimensionDictionary(dictionaries.getDimensionDictionary()); // metric loader might dependent on dimension dictionary, so load dimension first metricLoader.loadMetricDictionary(dictionaries.getMetricDictionary(), dictionaries.getDimensionDictionary()); tableLoader.loadTableDictionary(dictionaries); LOG.info("Initialized ConfigurationLoader"); LOG.info(dictionaries.toString()); }
@Override public void loadMetricDictionary(MetricDictionary metricDictionary, DimensionDictionary dimensionDictionary) { buildMetricMakers(metricDictionary); // Metrics that directly aggregate druid fields List<MetricInstance> metrics = Arrays.asList( new MetricInstance((ApiMetricName) A_HEIGHT, longSumMaker, HEIGHT), new MetricInstance(A_WIDTH, longSumMaker, WIDTH), new MetricInstance(A_DEPTH, longSumMaker, DEPTH), new MetricInstance(A_LIMBS, longSumMaker, LIMBS), new MetricInstance(A_USERS, sketchMaker, USERS), new MetricInstance(A_OTHER_USERS, sketchMaker, USERS), new MetricInstance(A_ROW_NUM, rowNumMaker, new FieldName[] {}), new MetricInstance(A_AREA, productMaker, A_HEIGHT, A_WIDTH), new MetricInstance(A_VOLUME, productMaker, A_HEIGHT, A_WIDTH, A_DEPTH), new MetricInstance(A_DAY_AVG_USERS, simpleDailyAverageMaker, A_USERS), new MetricInstance(A_DAY_AVG_OTHER_USERS, simpleDailyAverageMaker, A_OTHER_USERS), new MetricInstance(A_DAY_AVG_LIMBS, simpleDailyAverageMaker, A_LIMBS) ); metrics.stream().map(MetricInstance::make).forEach(metricDictionary::add); metricDictionary.getScope("shapes").add( new MetricInstance(new LogicalMetricInfo(A_SCOPED_WIDTH.asName()), longSumMaker, WIDTH.asName()).make() ); //Allows us to add some non-numeric LogicalMetrics without having to write a Maker for them. Makers should //be written if using complex metrics in production code. NonNumericMetrics.getLogicalMetrics().forEach(metricDictionary::add); } }
Collections.emptySet() ), new StringMetricMapper(), new LogicalMetricInfo( A_STRING_METRIC.getApiName(), Collections.emptySet() ), new BooleanMetricMapper(), new LogicalMetricInfo( A_BOOLEAN_METRIC.getApiName(), Collections.emptySet() ), new JsonNodeMetricMapper(), new LogicalMetricInfo( A_JSON_NODE_METRIC.getApiName(), Collections.emptySet() ), new NullMetricMapper(), new LogicalMetricInfo( A_NULL_METRIC.getApiName(),
/** * Makes a copy of the metric instance with new metric name. * * @param metricName The name of the Logical Metric in the metric dictionary * @return copy of the logical Metric */ public MetricInstance withName(String metricName) { return new MetricInstance( logicalMetricInfo, maker, dependencyMetricNames.toArray(new String[dependencyMetricNames.size()]) ); }
public MetricLoader getMetricLoader() { return new TestMetricLoader(); }
/** * Makes a copy of the metric instance with new maker. * * @param maker The Metric Maker that creates the actual Logical Metric * @return copy of the logical Metric */ public MetricInstance withMaker(MetricMaker maker) { return new MetricInstance( logicalMetricInfo, maker, dependencyMetricNames.toArray(new String[dependencyMetricNames.size()]) ); }