本文整理了Java中com.palominolabs.metrics.newrelic.table.YamlMetricsAttributeTableLoader
类的一些代码示例,展示了YamlMetricsAttributeTableLoader
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlMetricsAttributeTableLoader
类的具体详情如下:
包路径:com.palominolabs.metrics.newrelic.table.YamlMetricsAttributeTableLoader
类名称:YamlMetricsAttributeTableLoader
[英]Supplier of a Table created by reading a yaml file defined as follows:
metricName1:
TIMER_MAX: true
TIMER_MIN: false
metricName2:
COUNTER_COUNT: true
See TableMetricAttributeFilter.NewRelicMetric for all the metric options.
[中]通过读取定义如下的yaml文件创建的表的供应商:
metricName1:
TIMER_MAX: true
TIMER_MIN: false
metricName2:
COUNTER_COUNT: true
请参阅TableMetricTributeFilter。NewRelicMetric适用于所有公制选项。
代码示例来源:origin: palominolabs/metrics-new-relic
/**
* @param inputStream yaml data
* @return Table of metric toggles
* @throws IOException if loading fails
*/
public Table<String, NewRelicMetric, Boolean> loadTable(@Nonnull InputStream inputStream) throws IOException {
Map<String, Map<NewRelicMetric, Boolean>> m =
objectReader.forType(new TypeReference<Map<String, Map<NewRelicMetric, Boolean>>>() {})
.readValue(inputStream);
return table(m);
}
代码示例来源:origin: palominolabs/metrics-new-relic
private Table<String, NewRelicMetric, Boolean> getTable(String resource) throws IOException {
return new YamlMetricsAttributeTableLoader().loadTable(getClass().getResourceAsStream(resource));
}
}
代码示例来源:origin: palominolabs/metrics-new-relic
@Test
public void getReturnTableReadFromFile() throws Exception {
YamlMetricsAttributeTableLoader loader = new YamlMetricsAttributeTableLoader();
InputStream stream = getClass().getResourceAsStream("testing-config.yml");
Table<String, TableMetricAttributeFilter.NewRelicMetric, Boolean> table = loader.loadTable(stream);
assertThat(table.get("name2", TableMetricAttributeFilter.NewRelicMetric.TIMER_MAX), equalTo(true));
assertThat(table.get("name1", TableMetricAttributeFilter.NewRelicMetric.COUNTER_COUNT), equalTo(true));
}
}
内容来源于网络,如有侵权,请联系作者删除!