Tabnine Logo
DynamicLogger
Code IndexAdd Tabnine to your IDE (free)

How to use
DynamicLogger
in
io.pravega.shared.metrics

Best Java code snippets using io.pravega.shared.metrics.DynamicLogger (Showing top 20 results out of 315)

origin: pravega/pravega

public void operationLogTruncate(int count) {
  DYNAMIC_LOGGER.incCounterValue(this.operationLogSize, -count);
}
origin: pravega/pravega

  public void segmentCount(int count) {
    DYNAMIC_LOGGER.reportGaugeValue(this.activeSegmentCount, count);
  }
}
origin: pravega/pravega

  public void truncate() {
    DYNAMIC_LOGGER.recordMeterEvents(this.truncateCount, 1);
  }
}
origin: pravega/pravega

/**
 * This method increments the global and Stream-specific counters of seal Stream operations, set the number of open
 * Transactions to 0, and reports the latency of the operation.
 *
 * @param scope         Scope.
 * @param streamName    Name of the Stream.
 * @param latency       Latency of the sealStream operation.
 */
public void sealStream(String scope, String streamName, Duration latency) {
  DYNAMIC_LOGGER.incCounterValue(SEAL_STREAM, 1);
  DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(OPEN_TRANSACTIONS, scope, streamName), 0);
  sealStreamLatency.reportSuccessValue(latency.toMillis());
}
origin: pravega/pravega

/**
 * Test counter registered and  worked well with StatsLogger.
 */
@Test
public void testCounter() {
  Counter testCounter = statsLogger.createCounter("testCounter");
  testCounter.add(17);
  assertEquals(17, testCounter.get());
  // test dynamic counter
  int sum = 0;
  for (int i = 1; i < 10; i++) {
    sum += i;
    dynamicLogger.incCounterValue("dynamicCounter", i);
    assertEquals(sum, MetricRegistryUtils.getCounter("pravega.dynamicCounter.Counter").getCount());
  }
  dynamicLogger.freezeCounter("dynamicCounter");
  assertEquals(null, MetricRegistryUtils.getCounter("pravega.dynamicCounter.Counter"));
}
origin: pravega/pravega

/**
 * Test gauge registered and  worked well with StatsLogger.
 */
@Test
public void testGauge() {
  AtomicInteger value = new AtomicInteger(1);
  statsLogger.registerGauge("testGauge", value::get);
  value.set(2);
  assertEquals(value.get(), MetricRegistryUtils.getGauge("pravega.testStatsLogger.testGauge").getValue());
  for (int i = 1; i < 10; i++) {
    dynamicLogger.reportGaugeValue("dynamicGauge", i);
    assertEquals(i, MetricRegistryUtils.getGauge("pravega.dynamicGauge.Gauge").getValue());
  }
  dynamicLogger.freezeGaugeValue("dynamicGauge");
  assertEquals(null, MetricRegistryUtils.getGauge("pravega.dynamicGauge.Gauge"));
}
origin: pravega/pravega

public void operationLogInit() {
  DYNAMIC_LOGGER.updateCounterValue(this.operationLogSize, 0);
}
origin: pravega/pravega

@Override
public void freezeCounter(String name) {
  this.instance.get().freezeCounter(name);
}
origin: pravega/pravega

@Override
public void freezeGaugeValue(String name) {
  this.instance.get().freezeGaugeValue(name);
}
origin: pravega/pravega

/**
 * This method increments the global and Stream-specific counters of Stream creations, initializes other
 * stream-specific metrics and reports the latency of the operation.
 *
 * @param scope             Scope.
 * @param streamName        Name of the Stream.
 * @param minNumSegments    Initial number of segments for the Stream.
 * @param latency           Latency of the createStream operation.
 */
public void createStream(String scope, String streamName, int minNumSegments, Duration latency) {
  DYNAMIC_LOGGER.incCounterValue(CREATE_STREAM, 1);
  DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(OPEN_TRANSACTIONS, scope, streamName), 0);
  DYNAMIC_LOGGER.reportGaugeValue(nameFromStream(SEGMENTS_COUNT, scope, streamName), minNumSegments);
  DYNAMIC_LOGGER.incCounterValue(nameFromStream(SEGMENTS_SPLITS, scope, streamName), 0);
  DYNAMIC_LOGGER.incCounterValue(nameFromStream(SEGMENTS_MERGES, scope, streamName), 0);
  createStreamLatency.reportSuccessValue(latency.toMillis());
}
origin: pravega/pravega

@Override
public void updateCounterValue(String name, long value) {
  this.instance.get().updateCounterValue(name, value);
}
origin: pravega/pravega

@Override
public void deleteSegment(DeleteSegment deleteSegment) {
  String segment = deleteSegment.getSegment();
  final String operation = "deleteSegment";
  if (!verifyToken(segment, deleteSegment.getRequestId(), deleteSegment.getDelegationToken(), operation)) {
    return;
  }
  log.info(deleteSegment.getRequestId(), "Deleting segment {} ", deleteSegment);
  segmentStore.deleteStreamSegment(segment, TIMEOUT)
      .thenRun(() -> {
        connection.send(new SegmentDeleted(deleteSegment.getRequestId(), segment));
        dynamicLogger.freezeCounter(nameFromSegment(SEGMENT_WRITE_BYTES, segment));
        dynamicLogger.freezeCounter(nameFromSegment(SEGMENT_WRITE_EVENTS, segment));
        dynamicLogger.freezeCounter(nameFromSegment(SEGMENT_READ_BYTES, segment));
      })
      .exceptionally(e -> handleException(deleteSegment.getRequestId(), segment, operation, e));
}
origin: pravega/pravega

@Override
public void incCounterValue(String name, long delta) {
  this.instance.get().incCounterValue(name, delta);
}
origin: pravega/pravega

private void reportHostFailures(Host failedHost) {
  DYNAMIC_LOGGER.incCounterValue(globalMetricName(SEGMENT_STORE_HOST_FAILURES), 1);
  DYNAMIC_LOGGER.incCounterValue(nameFromHost(SEGMENT_STORE_HOST_FAILURES, failedHost.toString()), 1);
  // Set to 0 the number of containers for the failed host.
  DYNAMIC_LOGGER.reportGaugeValue(nameFromHost(SEGMENT_STORE_HOST_CONTAINER_COUNT, failedHost.toString()), 0);
}
origin: pravega/pravega

void ledgerCount(int count) {
  DYNAMIC_LOGGER.reportGaugeValue(this.ledgerCount, count);
}
origin: pravega/pravega

public void getAttributes() {
  DYNAMIC_LOGGER.recordMeterEvents(this.getAttributesCount, 1);
}
origin: pravega/pravega

/**
 * Reports the number of segment splits and merges related to a particular scale operation on a Stream. Both global
 * and Stream-specific counters are updated.
 *
 * @param scope         Scope.
 * @param streamName    Name of the Stream.
 * @param splits        Number of segment splits in the scale operation.
 * @param merges        Number of segment merges in the scale operation.
 */
public static void reportSegmentSplitsAndMerges(String scope, String streamName, long splits, long merges) {
  DYNAMIC_LOGGER.updateCounterValue(globalMetricName(SEGMENTS_SPLITS), splits);
  DYNAMIC_LOGGER.updateCounterValue(nameFromStream(SEGMENTS_SPLITS, scope, streamName), splits);
  DYNAMIC_LOGGER.updateCounterValue(globalMetricName(SEGMENTS_MERGES), merges);
  DYNAMIC_LOGGER.updateCounterValue(nameFromStream(SEGMENTS_MERGES, scope, streamName), merges);
}
origin: pravega/pravega

@Override
public void sealSegment(SealSegment sealSegment) {
  String segment = sealSegment.getSegment();
  final String operation = "sealSegment";
  if (!verifyToken(segment, sealSegment.getRequestId(), sealSegment.getDelegationToken(), operation)) {
    return;
  }
  log.info(sealSegment.getRequestId(), "Sealing segment {} ", sealSegment);
  segmentStore.sealStreamSegment(segment, TIMEOUT)
      .thenAccept(size -> connection.send(new SegmentSealed(sealSegment.getRequestId(), segment)))
      .whenComplete((r, e) -> {
        if (e != null) {
          handleException(sealSegment.getRequestId(), segment, operation, e);
        } else {
          dynamicLogger.freezeCounter(nameFromSegment(SEGMENT_WRITE_BYTES, segment));
          dynamicLogger.freezeCounter(nameFromSegment(SEGMENT_WRITE_EVENTS, segment));
          if (statsRecorder != null) {
            statsRecorder.sealSegment(sealSegment.getSegment());
          }
        }
      });
}
origin: pravega/pravega

  void bookKeeperWriteCompleted(int length, Duration elapsed) {
    this.writeLatency.reportSuccessEvent(elapsed);
    DYNAMIC_LOGGER.incCounterValue(MetricsNames.BK_WRITE_BYTES, length);
  }
}
origin: pravega/pravega

@Override
public <T extends Number> void reportGaugeValue(String name, T value) {
  this.instance.get().reportGaugeValue(name, value);
}
io.pravega.shared.metricsDynamicLogger

Javadoc

A simple interface that only exposes simple type metrics: Counter/Gauge.

Most used methods

  • incCounterValue
    Increase Counter with value delta .
  • reportGaugeValue
    Report gauge value.
  • recordMeterEvents
    Record the occurrence of a given number of events in Meter.
  • freezeCounter
    Notifies that the counter will not be updated.
  • updateCounterValue
    Updates the counter with value value.
  • freezeGaugeValue
    Notifies that the gauge value will not be updated.

Popular in Java

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JTextField (javax.swing)
  • Top Vim plugins
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