org.apache.gobblin.metrics.Tag.fromMap()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.apache.gobblin.metrics.Tag.fromMap()方法的一些代码示例,展示了Tag.fromMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.fromMap()方法的具体详情如下:
包路径:org.apache.gobblin.metrics.Tag
类名称:Tag
方法名:fromMap

Tag.fromMap介绍

[英]Converts a Map of key, value pairs to a List of Tags. Each key, value pair will be used to create a new Tag.
[中]将键、值对的映射转换为标记列表。每个键、值对将用于创建一个新标记。

代码示例

代码示例来源:origin: apache/incubator-gobblin

/**
 * Get additional {@link Tag}s required for any type of reporting.
 */
private List<? extends Tag<?>> getMetadataTags(String applicationName, String applicationId) {
 return Tag.fromMap(
   new ImmutableMap.Builder<String, Object>().put(GobblinClusterMetricTagNames.APPLICATION_NAME, applicationName)
     .put(GobblinClusterMetricTagNames.APPLICATION_ID, applicationId).build());
}

代码示例来源:origin: apache/incubator-gobblin

/**
 * Takes a {@link List} of {@link Tag}s and returns a new {@link List} with the original {@link Tag}s as well as any
 * additional {@link Tag}s returned by {@link ClusterNameTags#getClusterNameTags()}.
 *
 * @see ClusterNameTags
 */
private static List<Tag<?>> addClusterNameTags(List<? extends Tag<?>> tags) {
 return ImmutableList.<Tag<?>>builder().addAll(tags).addAll(Tag.fromMap(ClusterNameTags.getClusterNameTags()))
   .build();
}

代码示例来源:origin: apache/incubator-gobblin

private Compactor getCompactor(CompactorFactory compactorFactory, Optional<CompactorListener> compactorListener) {
 try {
  return compactorFactory
    .createCompactor(this.properties, Tag.fromMap(AzkabanTags.getAzkabanTags()), compactorListener);
 } catch (CompactorCreationException e) {
  throw new RuntimeException("Unable to create compactor", e);
 }
}

代码示例来源:origin: apache/incubator-gobblin

public AzkabanGobblinDaemon(String jobId, Properties props) throws Exception {
 super(jobId, LOG);
 List<Tag<?>> tags = Lists.newArrayList();
 tags.addAll(Tag.fromMap(AzkabanTags.getAzkabanTags()));
 RootMetricContext.get(tags);
 this.daemon = new SchedulerDaemon(props);
}

代码示例来源:origin: apache/incubator-gobblin

private GobblinMetrics initializeMetrics() {
 ImmutableList.Builder<Tag<?>> tags = ImmutableList.builder();
 tags.addAll(this.tags);
 tags.addAll(Tag.fromMap(ClusterNameTags.getClusterNameTags()));
 GobblinMetrics gobblinMetrics =
   GobblinMetrics.get(this.state.getProp(ConfigurationKeys.JOB_NAME_KEY), null, tags.build());
 gobblinMetrics.startMetricReporting(this.state.getProperties());
 return gobblinMetrics;
}

代码示例来源:origin: apache/incubator-gobblin

public ComplianceJob(Properties properties) {
 this.properties = properties;
 ExecutorService executor = ScalingThreadPoolExecutor.newScalingThreadPool(0,
   Integer.parseInt(properties.getProperty(ComplianceConfigurationKeys.MAX_CONCURRENT_DATASETS, ComplianceConfigurationKeys.DEFAULT_MAX_CONCURRENT_DATASETS)), 100,
   ExecutorsUtils.newThreadFactory(Optional.<Logger>absent(), Optional.of("complaince-job-pool-%d")));
 this.service = MoreExecutors.listeningDecorator(executor);
 this.closer = Closer.create();
 List<Tag<?>> tags = Lists.newArrayList();
 tags.addAll(Tag.fromMap(AzkabanTags.getAzkabanTags()));
 this.metricContext =
   this.closer.register(Instrumented.getMetricContext(new State(properties), ComplianceJob.class, tags));
 this.isMetricEnabled = GobblinMetrics.isEnabled(properties);
 this.eventSubmitter = new EventSubmitter.Builder(this.metricContext, ComplianceEvents.NAMESPACE).build();
 this.throwables = Lists.newArrayList();
}

代码示例来源:origin: apache/incubator-gobblin

this.jobsMapping = jobsMapping;
this.appWorkDir = builder.getAppWorkPath();
this.metadataTags = Tag.fromMap(new ImmutableMap.Builder<String, Object>()
  .put(GobblinClusterMetricTagNames.APPLICATION_NAME, builder.getApplicationName())
  .put(GobblinClusterMetricTagNames.APPLICATION_ID, builder.getApplicationId())

代码示例来源:origin: apache/incubator-gobblin

tags.addAll(Tag.fromMap(AzkabanTags.getAzkabanTags()));
RootMetricContext.get(tags);

代码示例来源:origin: apache/incubator-gobblin

tags.addAll(Tag.fromMap(AzkabanTags.getAzkabanTags()));

代码示例来源:origin: apache/incubator-gobblin

clusterNameTags.addAll(Tag.fromMap(ClusterNameTags.getClusterNameTags()));
GobblinMetrics.addCustomTagsToProperties(jobProps, clusterNameTags);

代码示例来源:origin: org.apache.gobblin/gobblin-cluster

/**
 * Get additional {@link Tag}s required for any type of reporting.
 */
private List<? extends Tag<?>> getMetadataTags(String applicationName, String applicationId) {
 return Tag.fromMap(
   new ImmutableMap.Builder<String, Object>().put(GobblinClusterMetricTagNames.APPLICATION_NAME, applicationName)
     .put(GobblinClusterMetricTagNames.APPLICATION_ID, applicationId).build());
}

代码示例来源:origin: org.apache.gobblin/gobblin-runtime

/**
 * Takes a {@link List} of {@link Tag}s and returns a new {@link List} with the original {@link Tag}s as well as any
 * additional {@link Tag}s returned by {@link ClusterNameTags#getClusterNameTags()}.
 *
 * @see ClusterNameTags
 */
private static List<Tag<?>> addClusterNameTags(List<? extends Tag<?>> tags) {
 return ImmutableList.<Tag<?>>builder().addAll(tags).addAll(Tag.fromMap(ClusterNameTags.getClusterNameTags()))
   .build();
}

代码示例来源:origin: org.apache.gobblin/gobblin-azkaban

private Compactor getCompactor(CompactorFactory compactorFactory, Optional<CompactorListener> compactorListener) {
 try {
  return compactorFactory
    .createCompactor(this.properties, Tag.fromMap(AzkabanTags.getAzkabanTags()), compactorListener);
 } catch (CompactorCreationException e) {
  throw new RuntimeException("Unable to create compactor", e);
 }
}

代码示例来源:origin: org.apache.gobblin/gobblin-azkaban

public AzkabanGobblinDaemon(String jobId, Properties props) throws Exception {
 super(jobId, LOG);
 List<Tag<?>> tags = Lists.newArrayList();
 tags.addAll(Tag.fromMap(AzkabanTags.getAzkabanTags()));
 RootMetricContext.get(tags);
 this.daemon = new SchedulerDaemon(props);
}

代码示例来源:origin: org.apache.gobblin/gobblin-compaction

private GobblinMetrics initializeMetrics() {
 ImmutableList.Builder<Tag<?>> tags = ImmutableList.builder();
 tags.addAll(this.tags);
 tags.addAll(Tag.fromMap(ClusterNameTags.getClusterNameTags()));
 GobblinMetrics gobblinMetrics =
   GobblinMetrics.get(this.state.getProp(ConfigurationKeys.JOB_NAME_KEY), null, tags.build());
 gobblinMetrics.startMetricReporting(this.state.getProperties());
 return gobblinMetrics;
}

代码示例来源:origin: org.apache.gobblin/gobblin-cluster

public GobblinHelixJobTask (TaskCallbackContext context,
              StateStores stateStores,
              TaskRunnerSuiteBase.Builder builder,
              GobblinHelixJobLauncherMetrics launcherMetrics,
              GobblinHelixJobTaskMetrics jobTaskMetrics) {
 this.jobTaskMetrics = jobTaskMetrics;
 this.taskConfig = context.getTaskConfig();
 this.sysConfig = builder.getConfig();
 this.helixManager = builder.getHelixManager();
 this.jobPlusSysConfig = ConfigUtils.configToProperties(sysConfig);
 this.jobLauncherListener = new GobblinHelixJobLauncherListener(launcherMetrics);
 Map<String, String> configMap = this.taskConfig.getConfigMap();
 for (Map.Entry<String, String> entry: configMap.entrySet()) {
  if (entry.getKey().startsWith(GobblinHelixDistributeJobExecutionLauncher.JOB_PROPS_PREFIX)) {
    String key = entry.getKey().replaceFirst(GobblinHelixDistributeJobExecutionLauncher.JOB_PROPS_PREFIX, "");
   jobPlusSysConfig.put(key, entry.getValue());
  }
 }
 if (!jobPlusSysConfig.containsKey(GobblinClusterConfigurationKeys.PLANNING_ID_KEY)) {
  throw new RuntimeException("Job doesn't have planning ID");
 }
 this.planningJobId = jobPlusSysConfig.getProperty(GobblinClusterConfigurationKeys.PLANNING_ID_KEY);
 this.stateStores = stateStores;
 this.appWorkDir = builder.getAppWorkPath();
 this.metadataTags = Tag.fromMap(new ImmutableMap.Builder<String, Object>()
   .put(GobblinClusterMetricTagNames.APPLICATION_NAME, builder.getApplicationName())
   .put(GobblinClusterMetricTagNames.APPLICATION_ID, builder.getApplicationId())
   .build());
}

代码示例来源:origin: org.apache.gobblin/gobblin-data-management

tags.addAll(Tag.fromMap(AzkabanTags.getAzkabanTags()));

代码示例来源:origin: org.apache.gobblin/gobblin-azkaban

tags.addAll(Tag.fromMap(AzkabanTags.getAzkabanTags()));
RootMetricContext.get(tags);

代码示例来源:origin: org.apache.gobblin/gobblin-runtime

clusterNameTags.addAll(Tag.fromMap(ClusterNameTags.getClusterNameTags()));
GobblinMetrics.addCustomTagsToProperties(jobProps, clusterNameTags);

相关文章