Tabnine Logo
OpStatsLogger.toOpStatsData
Code IndexAdd Tabnine to your IDE (free)

How to use
toOpStatsData
method
in
io.pravega.shared.metrics.OpStatsLogger

Best Java code snippets using io.pravega.shared.metrics.OpStatsLogger.toOpStatsData (Showing top 4 results out of 315)

origin: pravega/pravega

@Override
public OpStatsData toOpStatsData() {
  return getInstance().toOpStatsData();
}
origin: pravega/pravega

long expectedMetricsSuccesses = FileSystemMetrics.WRITE_LATENCY.toOpStatsData().getNumSuccessfulEvents();
    expectedMetricsSize, FileSystemMetrics.WRITE_BYTES.get());
Assert.assertEquals("WRITE_LATENCY should not increase the count of successful events in case of unsuccessful writes",
    expectedMetricsSuccesses, FileSystemMetrics.WRITE_LATENCY.toOpStatsData().getNumSuccessfulEvents());
  expectedMetricsSuccesses += 1;
  Assert.assertEquals("WRITE_LATENCY should increase the count of successful events in case of successful writes",
      expectedMetricsSuccesses, FileSystemMetrics.WRITE_LATENCY.toOpStatsData().getNumSuccessfulEvents());
  Assert.assertEquals("WRITE_BYTES should increase by the size of successful writes",
      expectedMetricsSize, FileSystemMetrics.WRITE_BYTES.get());
    expectedMetricsSize, FileSystemMetrics.WRITE_BYTES.get());
Assert.assertEquals("WRITE_LATENCY should not increase the count of successful events in case of unsuccessful writes",
    expectedMetricsSuccesses, FileSystemMetrics.WRITE_LATENCY.toOpStatsData().getNumSuccessfulEvents());
    expectedMetricsSize, FileSystemMetrics.WRITE_BYTES.get());
Assert.assertEquals("WRITE_LATENCY should not increase the count of successful events in case of unsuccessful writes",
    expectedMetricsSuccesses, FileSystemMetrics.WRITE_LATENCY.toOpStatsData().getNumSuccessfulEvents());
origin: pravega/pravega

@Test(timeout = 20000)
public void testCreateSegment() throws Exception {
  // Set up PravegaRequestProcessor instance to execute requests against
  String streamSegmentName = "testCreateSegment";
  @Cleanup
  ServiceBuilder serviceBuilder = newInlineExecutionInMemoryBuilder(getBuilderConfig());
  serviceBuilder.initialize();
  StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
  ServerConnection connection = mock(ServerConnection.class);
  InOrder order = inOrder(connection);
  PravegaRequestProcessor processor = new PravegaRequestProcessor(store,  mock(TableStore.class), connection);
  // Execute and Verify createSegment/getStreamSegmentInfo calling stack is executed as design.
  processor.createSegment(new WireCommands.CreateSegment(1, streamSegmentName, WireCommands.CreateSegment.NO_SCALE, 0, ""));
  assertTrue(append(streamSegmentName, 1, store));
  processor.getStreamSegmentInfo(new WireCommands.GetStreamSegmentInfo(1, streamSegmentName, ""));
  assertTrue(append(streamSegmentName, 2, store));
  order.verify(connection).send(new WireCommands.SegmentCreated(1, streamSegmentName));
  order.verify(connection).send(Mockito.any(WireCommands.StreamSegmentInfo.class));
  // TestCreateSealDelete may executed before this test case,
  // so createSegmentStats may record 1 or 2 createSegment operation here.
  OpStatsData createSegmentStats = processor.getCreateStreamSegment().toOpStatsData();
  assertNotEquals(0, createSegmentStats.getNumSuccessfulEvents());
  assertEquals(0, createSegmentStats.getNumFailedEvents());
}
origin: pravega/pravega

/**
 * Test Event and Value registered and worked well with OpStats.
 */
@Test
public void testOpStatsData() {
  Timer startTime = new Timer();
  OpStatsLogger opStatsLogger = statsLogger.createStats("testOpStatsLogger");
  // register 2 event: 1 success, 1 fail.
  opStatsLogger.reportSuccessEvent(startTime.getElapsed());
  opStatsLogger.reportFailEvent(startTime.getElapsed());
  opStatsLogger.reportSuccessValue(startTime.getElapsedMillis());
  opStatsLogger.reportFailValue(startTime.getElapsedMillis());
  opStatsLogger.reportSuccessValue(1);
  opStatsLogger.reportFailValue(1);
  opStatsLogger.reportSuccessValue(1);
  OpStatsData statsData = opStatsLogger.toOpStatsData();
  // 2 = 2 event + 2 value
  assertEquals(4, statsData.getNumSuccessfulEvents());
  assertEquals(3, statsData.getNumFailedEvents());
}
io.pravega.shared.metricsOpStatsLoggertoOpStatsData

Javadoc

To op Stats data. Need this function to support JMX exports and inner test.

Popular methods of OpStatsLogger

  • reportSuccessEvent
    Increment the succeeded op counter with the given eventLatency in NanoSeconds.
  • reportSuccessValue
    An operation with the given value succeeded.
  • close
  • reportFailEvent
    Increment the failed op counter with the given eventLatency in NanoSeconds.
  • reportFailValue
    An operation with the given value failed.
  • clear
    Clear stats for this operation.

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Top Sublime Text 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