Tabnine Logo
MetricsCollectionService.getContext
Code IndexAdd Tabnine to your IDE (free)

How to use
getContext
method
in
co.cask.cdap.api.metrics.MetricsCollectionService

Best Java code snippets using co.cask.cdap.api.metrics.MetricsCollectionService.getContext (Showing top 20 results out of 315)

origin: co.cask.cdap/cdap-common

 @Override
 public MetricsContext load(Map<String, String> key) throws Exception {
  return metricsCollectionService.getContext(key);
 }
});
origin: caskdata/cdap

 @Override
 public MetricsContext load(Map<String, String> key) throws Exception {
  return metricsCollectionService.getContext(key);
 }
});
origin: co.cask.cdap/cdap-data-fabric

 @Override
 public MetricsContext load(NamespaceId namespaceId) {
  return metricsCollectionService.getContext(getStreamMetricsContext(namespaceId));
 }
});
origin: cdapio/cdap

 @Override
 public MetricsContext get() {
  MetricsContext context = this.context;
  if (context == null) {
   // The service.getContext already handle concurrent calls, so no need to synchronize here
   this.context = context = serviceProvider.get().getContext(Constants.Metrics.TRANSACTION_MANAGER_CONTEXT);
  }
  return context;
 }
};
origin: co.cask.cdap/cdap-data-fabric

 @Override
 public MetricsContext get() {
  MetricsContext context = this.context;
  if (context == null) {
   // The service.getContext already handle concurrent calls, so no need to synchronize here
   this.context = context = serviceProvider.get().getContext(Constants.Metrics.TRANSACTION_MANAGER_CONTEXT);
  }
  return context;
 }
};
origin: co.cask.cdap/cdap-app-fabric

ProgramRunnableResourceReporter(ProgramId programId,
                MetricsCollectionService collectionService, TwillContext context) {
 super(collectionService.getContext(getMetricContext(programId, context)));
 this.runContext = context;
}
origin: caskdata/cdap

 @Override
 protected Service createService(Set<Integer> topicNumbers) {
  return factory.create(topicNumbers,
             metricsCollectionService.getContext(Constants.Metrics.METRICS_PROCESSOR_CONTEXT), instanceId);
 }
}
origin: cdapio/cdap

ProgramRunnableResourceReporter(ProgramId programId,
                MetricsCollectionService collectionService, TwillContext context) {
 super(collectionService.getContext(getMetricContext(programId, context)));
 this.runContext = context;
}
origin: co.cask.cdap/cdap-watchdog

 @Override
 protected Service createService(Set<Integer> topicNumbers) {
  return factory.create(topicNumbers,
             metricsCollectionService.getContext(Constants.Metrics.METRICS_PROCESSOR_CONTEXT), instanceId);
 }
}
origin: cdapio/cdap

 @Override
 public DynamicDatasetCache get() {
  SystemDatasetInstantiator dsInstantiator = new SystemDatasetInstantiator(dsFramework);
  return new MultiThreadDatasetCache(
   dsInstantiator, txClient, NamespaceId.SYSTEM, ImmutableMap.of(),
   metricsCollectionService.getContext(ImmutableMap.of()),
   ImmutableMap.of()
  );
 }
}
origin: co.cask.cdap/cdap-app-fabric

 @Override
 public DynamicDatasetCache get() {
  SystemDatasetInstantiator dsInstantiator = new SystemDatasetInstantiator(dsFramework);
  return new MultiThreadDatasetCache(
   dsInstantiator, txClient, NamespaceId.SYSTEM, ImmutableMap.of(),
   metricsCollectionService.getContext(ImmutableMap.of()),
   ImmutableMap.of()
  );
 }
}
origin: cdapio/cdap

ClusterResourceReporter(MetricsCollectionService metricsCollectionService, Configuration hConf) {
 super(metricsCollectionService.getContext(ImmutableMap.of()));
 YarnClient yarnClient = YarnClient.createYarnClient();
 yarnClient.init(hConf);
 this.yarnClient = yarnClient;
}
origin: co.cask.cdap/cdap-app-fabric

ClusterResourceReporter(MetricsCollectionService metricsCollectionService, Configuration hConf) {
 super(metricsCollectionService.getContext(ImmutableMap.of()));
 YarnClient yarnClient = YarnClient.createYarnClient();
 yarnClient.init(hConf);
 this.yarnClient = yarnClient;
}
origin: caskdata/cdap

 /**
  * Creates a {@link MetricsContext} for {@link MessageCache} to use for the given topic.
  */
 private MetricsContext createMetricsContext(CConfiguration cConf, TopicId topicId,
                       MetricsCollectionService metricsCollectionService) {
  return metricsCollectionService.getContext(ImmutableMap.of(
   Constants.Metrics.Tag.COMPONENT, Constants.Service.MESSAGING_SERVICE,
   Constants.Metrics.Tag.INSTANCE_ID, cConf.get(Constants.MessagingSystem.CONTAINER_INSTANCE_ID, "0"),
   Constants.Metrics.Tag.NAMESPACE, topicId.getNamespace(),
   Constants.Metrics.Tag.TOPIC, topicId.getTopic()
  ));
 }
}
origin: co.cask.cdap/cdap-tms

 /**
  * Creates a {@link MetricsContext} for {@link MessageCache} to use for the given topic.
  */
 private MetricsContext createMetricsContext(CConfiguration cConf, TopicId topicId,
                       MetricsCollectionService metricsCollectionService) {
  return metricsCollectionService.getContext(ImmutableMap.of(
   Constants.Metrics.Tag.COMPONENT, Constants.Service.MESSAGING_SERVICE,
   Constants.Metrics.Tag.INSTANCE_ID, cConf.get(Constants.MessagingSystem.CONTAINER_INSTANCE_ID, "0"),
   Constants.Metrics.Tag.NAMESPACE, topicId.getNamespace(),
   Constants.Metrics.Tag.TOPIC, topicId.getTopic()
  ));
 }
}
origin: cdapio/cdap

/**
 * Emit the metrics context for the program, the tags are constructed with the program run id and
 * the profile id
 */
private void emitProfileMetrics(ProgramRunId programRunId, ProfileId profileId, String metricName) {
 Map<String, String> tags = ImmutableMap.<String, String>builder()
  .put(Constants.Metrics.Tag.PROFILE_SCOPE, profileId.getScope().name())
  .put(Constants.Metrics.Tag.PROFILE, profileId.getProfile())
  .put(Constants.Metrics.Tag.NAMESPACE, programRunId.getNamespace())
  .put(Constants.Metrics.Tag.PROGRAM_TYPE, programRunId.getType().getPrettyName())
  .put(Constants.Metrics.Tag.APP, programRunId.getApplication())
  .put(Constants.Metrics.Tag.PROGRAM, programRunId.getProgram())
  .put(Constants.Metrics.Tag.RUN_ID, programRunId.getRun())
  .build();
 metricsCollectionService.getContext(tags).increment(metricName, 1L);
}
origin: cdapio/cdap

/**
 * Creates a {@link MetricsContext} for metrics emission of the program represented by this context.
 *
 * @param programRunId the {@link ProgramRunId} of the current execution
 * @param metricsService the underlying service for metrics publishing; or {@code null} to suppress metrics publishing
 * @param metricsTags a set of extra tags to be used for creating the {@link MetricsContext}
 * @return a {@link MetricsContext} for emitting metrics for the current program context.
 */
private MetricsContext createProgramMetrics(ProgramRunId programRunId,
                      @Nullable MetricsCollectionService metricsService,
                      Map<String, String> metricsTags) {
 Map<String, String> tags = Maps.newHashMap(metricsTags);
 tags.put(Constants.Metrics.Tag.NAMESPACE, programRunId.getNamespace());
 tags.put(Constants.Metrics.Tag.APP, programRunId.getApplication());
 tags.put(ProgramTypeMetricTag.getTagName(programRunId.getType()), programRunId.getProgram());
 tags.put(Constants.Metrics.Tag.RUN_ID, programRunId.getRun());
 return metricsService == null ? new NoopMetricsContext(tags) : metricsService.getContext(tags);
}
origin: co.cask.cdap/cdap-app-fabric

/**
 * Emit the metrics context for the program, the tags are constructed with the program run id and
 * the profile id
 */
private void emitProfileMetrics(ProgramRunId programRunId, ProfileId profileId, String metricName) {
 Map<String, String> tags = ImmutableMap.<String, String>builder()
  .put(Constants.Metrics.Tag.PROFILE_SCOPE, profileId.getScope().name())
  .put(Constants.Metrics.Tag.PROFILE, profileId.getProfile())
  .put(Constants.Metrics.Tag.NAMESPACE, programRunId.getNamespace())
  .put(Constants.Metrics.Tag.PROGRAM_TYPE, programRunId.getType().getPrettyName())
  .put(Constants.Metrics.Tag.APP, programRunId.getApplication())
  .put(Constants.Metrics.Tag.PROGRAM, programRunId.getProgram())
  .put(Constants.Metrics.Tag.RUN_ID, programRunId.getRun())
  .build();
 metricsCollectionService.getContext(tags).increment(metricName, 1L);
}
origin: co.cask.cdap/cdap-watchdog

protected AbstractAppenderContext(DatasetFramework datasetFramework,
                 TransactionSystemClient txClient,
                 LocationFactory locationFactory,
                 MetricsCollectionService metricsCollectionService) {
 this.locationFactory = locationFactory;
 // No need to have retry for dataset admin operations
 // The log framework itself will perform retries and state management
 this.datasetManager = new DefaultDatasetManager(datasetFramework, NamespaceId.SYSTEM,
                         co.cask.cdap.common.service.RetryStrategies.noRetry(), null);
 this.transactional = Transactions.createTransactionalWithRetry(
  Transactions.createTransactional(new MultiThreadDatasetCache(
   new SystemDatasetInstantiator(datasetFramework), txClient,
   NamespaceId.SYSTEM, ImmutableMap.<String, String>of(), null, null)),
  RetryStrategies.retryOnConflict(20, 100)
 );
 this.metricsContext = metricsCollectionService.getContext(Collections.<String, String>emptyMap());
}
origin: caskdata/cdap

protected AbstractAppenderContext(DatasetFramework datasetFramework,
                 TransactionSystemClient txClient,
                 LocationFactory locationFactory,
                 MetricsCollectionService metricsCollectionService) {
 this.locationFactory = locationFactory;
 // No need to have retry for dataset admin operations
 // The log framework itself will perform retries and state management
 this.datasetManager = new DefaultDatasetManager(datasetFramework, NamespaceId.SYSTEM,
                         co.cask.cdap.common.service.RetryStrategies.noRetry(), null);
 this.transactional = Transactions.createTransactionalWithRetry(
  Transactions.createTransactional(new MultiThreadDatasetCache(
   new SystemDatasetInstantiator(datasetFramework), txClient,
   NamespaceId.SYSTEM, ImmutableMap.<String, String>of(), null, null)),
  RetryStrategies.retryOnConflict(20, 100)
 );
 this.metricsContext = metricsCollectionService.getContext(Collections.<String, String>emptyMap());
}
co.cask.cdap.api.metricsMetricsCollectionServicegetContext

Javadoc

Returns the metric collector for the given context.

Popular methods of MetricsCollectionService

  • stopAndWait
  • startAndWait
  • start

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • onRequestPermissionsResult (Fragment)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now