本文整理汇总了Java中org.kitesdk.morphline.base.Metrics类的典型用法代码示例。如果您正苦于以下问题:Java Metrics类的具体用法?Java Metrics怎么用?Java Metrics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Metrics类属于org.kitesdk.morphline.base包,在下文中一共展示了Metrics类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LoadElasticsearch
import org.kitesdk.morphline.base.Metrics; //导入依赖的package包/类
LoadElasticsearch(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
super(builder, config, parent, child, context);
elapsedTime = getTimer(Metrics.ELAPSED_TIME);
Config elasticsearchConfig = getConfigs().getConfig(config, ELASTICSEARCH_CONFIGURATION);
String loaderType = getConfigs().getString(config, DOCUMENT_LOADER_TYPE);
indexName = new FieldExpression(getConfigs().getString(config, INDEX_NAME), getConfig());
indexType = new FieldExpression(getConfigs().getString(config, TYPE), getConfig());
ignoreFields = new LinkedHashSet<String>(getConfigs().getStringList(config, IGNORE_FIELDS, new ArrayList<String>()));
ttl = getConfigs().getInt(config, TTL);
validateArguments();
DocumentLoaderFactory documentLoaderFactory = new DocumentLoaderFactory();
try {
loader = documentLoaderFactory.getClient(loaderType, elasticsearchConfig);
} catch (IllegalArgumentException e) {
throw new MorphlineRuntimeException(e);
}
}
示例2: configure
import org.kitesdk.morphline.base.Metrics; //导入依赖的package包/类
@Override
public void configure(Context context) {
String morphlineFile = context.getString(MORPHLINE_FILE_PARAM);
String morphlineId = context.getString(MORPHLINE_ID_PARAM);
if (morphlineFile == null || morphlineFile.trim().length() == 0) {
throw new MorphlineCompilationException("Missing parameter: " + MORPHLINE_FILE_PARAM, null);
}
morphlineFileAndId = morphlineFile + "@" + morphlineId;
if (morphlineContext == null) {
FaultTolerance faultTolerance = new FaultTolerance(
context.getBoolean(FaultTolerance.IS_PRODUCTION_MODE, false),
context.getBoolean(FaultTolerance.IS_IGNORING_RECOVERABLE_EXCEPTIONS, false),
context.getString(FaultTolerance.RECOVERABLE_EXCEPTION_CLASSES));
morphlineContext = new MorphlineContext.Builder()
.setExceptionHandler(faultTolerance)
.setMetricRegistry(SharedMetricRegistries.getOrCreate(morphlineFileAndId))
.build();
}
Config override = ConfigFactory.parseMap(
context.getSubProperties(MORPHLINE_VARIABLE_PARAM + "."));
morphline = new Compiler().compile(
new File(morphlineFile), morphlineId, morphlineContext, finalChild, override);
this.mappingTimer = morphlineContext.getMetricRegistry().timer(
MetricRegistry.name("morphline.app", Metrics.ELAPSED_TIME));
this.numRecords = morphlineContext.getMetricRegistry().meter(
MetricRegistry.name("morphline.app", Metrics.NUM_RECORDS));
this.numFailedRecords = morphlineContext.getMetricRegistry().meter(
MetricRegistry.name("morphline.app", "numFailedRecords"));
this.numExceptionRecords = morphlineContext.getMetricRegistry().meter(
MetricRegistry.name("morphline.app", "numExceptionRecords"));
}
示例3: LoadSolr
import org.kitesdk.morphline.base.Metrics; //导入依赖的package包/类
public LoadSolr(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
super(builder, config, parent, child, context);
Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator");
SolrLocator locator = new SolrLocator(solrLocatorConfig, context);
LOG.debug("solrLocator: {}", locator);
this.loader = locator.getLoader();
Config boostsConfig = getConfigs().getConfig(config, "boosts", ConfigFactory.empty());
for (Map.Entry<String, Object> entry : new Configs().getEntrySet(boostsConfig)) {
String fieldName = entry.getKey();
float boost = Float.parseFloat(entry.getValue().toString().trim());
boosts.put(fieldName, boost);
}
validateArguments();
this.elapsedTime = getTimer(Metrics.ELAPSED_TIME);
}