congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
HermesMetrics.timer
Code IndexAdd Tabnine to your IDE (free)

How to use
timer
method
in
pl.allegro.tech.hermes.common.metric.HermesMetrics

Best Java code snippets using pl.allegro.tech.hermes.common.metric.HermesMetrics.timer (Showing top 7 results out of 315)

origin: allegro/hermes

public ConsumerLatencyTimer(HermesMetrics hermesMetrics, TopicName topicName, String subscriptionName) {
  latencyTimer = hermesMetrics.timer(Timers.LATENCY);
  subscriptionLatencyTimer = hermesMetrics.timer(Timers.SUBSCRIPTION_LATENCY, topicName, subscriptionName);
}
origin: allegro/hermes

private void awaitUntilNextPoll() {
  try (Timer.Context ctx = metrics.timer(CONSUMER_IDLE_TIME,
      subscription.getTopicName(),
      subscription.getName()).time()) {
    Thread.sleep(idleTimeCalculator.increaseIdleTime());
  } catch (InterruptedException ex) {
    Thread.currentThread().interrupt();
  }
}
origin: pl.allegro.tech.hermes/hermes-consumers

private void awaitUntilNextPoll() {
  try (Timer.Context ctx = metrics.timer(CONSUMER_IDLE_TIME,
      subscription.getTopicName(),
      subscription.getName()).time()) {
    Thread.sleep(idleTimeCalculator.increaseIdleTime());
  } catch (InterruptedException ex) {
    Thread.currentThread().interrupt();
  }
}
origin: allegro/hermes

public Timer subscriptionLatencyTimer(Subscription subscription) {
  return timer(SUBSCRIPTION_LATENCY, subscription.getTopicName(), subscription.getName());
}
origin: allegro/hermes

public CachedTopic(Topic topic, HermesMetrics hermesMetrics, KafkaTopics kafkaTopics, boolean blacklisted) {
  this.topic = topic;
  this.kafkaTopics = kafkaTopics;
  this.hermesMetrics = hermesMetrics;
  this.blacklisted = blacklisted;
  globalRequestMeter = hermesMetrics.meter(Meters.METER);
  topicRequestMeter = hermesMetrics.meter(Meters.TOPIC_METER, topic.getName());
  globalDelayedProcessingMeter = hermesMetrics.meter(Meters.DELAYED_PROCESSING);
  topicDelayedProcessingMeter = hermesMetrics.meter(Meters.TOPIC_DELAYED_PROCESSING, topic.getName());
  globalRequestReadLatencyTimer = hermesMetrics.timer(Timers.PARSING_REQUEST);
  topicRequestReadLatencyTimer = hermesMetrics.timer(Timers.TOPIC_PARSING_REQUEST, topic.getName());
  globalMessageCreationTimer = hermesMetrics.timer(Timers.MESSAGE_CREATION_LATENCY);
  topicMessageCreationTimer = hermesMetrics.timer(Timers.MESSAGE_CREATION_TOPIC_LATENCY, topic.getName());
  topicMessageContentSize = hermesMetrics.messageContentSizeHistogram(topic.getName());
  globalMessageContentSize = hermesMetrics.messageContentSizeHistogram();
  published = hermesMetrics.counter(Counters.PUBLISHED, topic.getName());
  globalThroughputMeter = hermesMetrics.meter(Meters.THROUGHPUT_BYTES);
  topicThroughputMeter = hermesMetrics.meter(Meters.TOPIC_THROUGHPUT_BYTES, topic.getName());
  if (Topic.Ack.ALL.equals(topic.getAck())) {
    topicProducerLatencyTimer = hermesMetrics.timer(Timers.ACK_ALL_LATENCY);
    globalProducerLatencyTimer = hermesMetrics.timer(Timers.ACK_ALL_TOPIC_LATENCY, topic.getName());
    topicBrokerLatencyTimer = hermesMetrics.timer(Timers.ACK_ALL_BROKER_LATENCY);
    globalBrokerLatencyTimer = hermesMetrics.timer(Timers.ACK_ALL_BROKER_TOPIC_LATENCY, topic.getName());
  } else {
    topicProducerLatencyTimer = hermesMetrics.timer(Timers.ACK_LEADER_LATENCY);
    globalProducerLatencyTimer = hermesMetrics.timer(Timers.ACK_LEADER_TOPIC_LATENCY, topic.getName());
    topicBrokerLatencyTimer = hermesMetrics.timer(Timers.ACK_LEADER_BROKER_LATENCY);
    globalBrokerLatencyTimer = hermesMetrics.timer(Timers.ACK_LEADER_BROKER_TOPIC_LATENCY, topic.getName());
  }
}
origin: allegro/hermes

@Override
public void run() {
  try (Timer.Context c = metrics.timer("offset-committer.duration").time()) {
    // committed offsets need to be drained first so that there is no possibility of new committed offsets
    // showing up after inflight queue is drained - this would lead to stall in committing offsets
    ReducingConsumer committedOffsetsReducer = processCommittedOffsets();
    Map<SubscriptionPartition, Long> maxCommittedOffsets = committedOffsetsReducer.reduced;
    ReducingConsumer inflightOffsetReducer = processInflightOffsets(committedOffsetsReducer.all);
    Map<SubscriptionPartition, Long> minInflightOffsets = inflightOffsetReducer.reduced;
    int scheduledToCommit = 0;
    OffsetsToCommit offsetsToCommit = new OffsetsToCommit();
    for (SubscriptionPartition partition : Sets.union(minInflightOffsets.keySet(), maxCommittedOffsets.keySet())) {
      long offset = Math.min(
          minInflightOffsets.getOrDefault(partition, Long.MAX_VALUE),
          maxCommittedOffsets.getOrDefault(partition, Long.MAX_VALUE)
      );
      if (offset >= 0 && offset < Long.MAX_VALUE) {
        scheduledToCommit++;
        offsetsToCommit.add(new SubscriptionPartitionOffset(partition, offset));
      }
    }
    messageCommitter.commitOffsets(offsetsToCommit);
    metrics.counter("offset-committer.committed").inc(scheduledToCommit);
    cleanupUnusedSubscriptions();
  } catch (Exception exception) {
    logger.error("Failed to run offset committer: {}", exception.getMessage(), exception);
  }
}
origin: pl.allegro.tech.hermes/hermes-consumers

@Override
public void run() {
  try (Timer.Context c = metrics.timer("offset-committer.duration").time()) {
    // committed offsets need to be drained first so that there is no possibility of new committed offsets
    // showing up after inflight queue is drained - this would lead to stall in committing offsets
    ReducingConsumer committedOffsetsReducer = processCommittedOffsets();
    Map<SubscriptionPartition, Long> maxCommittedOffsets = committedOffsetsReducer.reduced;
    ReducingConsumer inflightOffsetReducer = processInflightOffsets(committedOffsetsReducer.all);
    Map<SubscriptionPartition, Long> minInflightOffsets = inflightOffsetReducer.reduced;
    int scheduledToCommit = 0;
    OffsetsToCommit offsetsToCommit = new OffsetsToCommit();
    for (SubscriptionPartition partition : Sets.union(minInflightOffsets.keySet(), maxCommittedOffsets.keySet())) {
      long offset = Math.min(
          minInflightOffsets.getOrDefault(partition, Long.MAX_VALUE),
          maxCommittedOffsets.getOrDefault(partition, Long.MAX_VALUE)
      );
      if (offset >= 0 && offset < Long.MAX_VALUE) {
        scheduledToCommit++;
        offsetsToCommit.add(new SubscriptionPartitionOffset(partition, offset));
      }
    }
    messageCommitter.commitOffsets(offsetsToCommit);
    metrics.counter("offset-committer.committed").inc(scheduledToCommit);
    cleanupUnusedSubscriptions();
  } catch (Exception exception) {
    logger.error("Failed to run offset committer: {}", exception.getMessage(), exception);
  }
}
pl.allegro.tech.hermes.common.metricHermesMetricstimer

Popular methods of HermesMetrics

  • counter
  • meter
  • consumerErrorsOtherMeter
  • escapeDots
  • latencyTimer
  • registerGauge
  • consumerErrorsTimeoutMeter
  • consumersWorkloadRebalanceDurationTimer
  • decrementInflightCounter
  • incrementInflightCounter
  • inflightTimeHistogram
  • maxRateFetchFailuresCounter
  • inflightTimeHistogram,
  • maxRateFetchFailuresCounter,
  • oAuthProviderLatencyTimer,
  • oAuthSubscriptionTokenRequestMeter,
  • rateHistoryFailuresCounter,
  • registerConsumerHttpAnswer,
  • registerConsumersThreadGauge,
  • registerDyingConsumerProcessesCountGauge,
  • registerMaxRateGauge

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getContentResolver (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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