Examples of DbusEventsTotalStats


Examples of com.linkedin.databus.core.monitoring.mbean.DbusEventsTotalStats

      Assert.assertNotEquals(relay, null);
      r1 = new DatabusRelayTestUtil.RelayRunner(relay);

      // async starts
      r1.start();
      DbusEventsTotalStats stats = relay.getInboundEventStatisticsCollector().getTotalStats();

      // start client in parallel
      String srcSubscriptionString = srcName;
      String serverName = "localhost:" + relayPort;
      ResetsCountingConsumer countingConsumer = new ResetsCountingConsumer();
      DatabusSourcesConnection clientConn = RelayEventProducer
      .createDatabusSourcesConnection("testProducer", serverName,
          srcSubscriptionString, countingConsumer,
          1 * 1024 * 1024, 50000, 30 * 1000, 100, 15 * 1000,
          1, true);

      cr = new ClientRunner(clientConn);
      cr.start();
      TestUtil.sleep(1000); // generate some events

      // pause event generator
      // and wait untill all the events are consumed
      // but since it is less then timeout the connection should NOT reset
      LOG.info("Sending pause to relay!");
      r1.pause();
      TestUtil.sleep(4000);

      LOG.info("no events, time less then threshold. Events=" + countingConsumer.getNumDataEvents() +
          "; resets = " + countingConsumer.getNumResets());
      Assert.assertEquals(countingConsumer.getNumResets(), 0);

      // generate more events, more time elapsed then the threshold, but since there are
      // events - NO reset
      r1.unpause();
      Thread.sleep(8000);
      LOG.info("some events, more time then timeout. Events=" + countingConsumer.getNumDataEvents() +
          "; resets = " + countingConsumer.getNumResets());
      Assert.assertEquals(countingConsumer.getNumResets(), 0);

      r1.pause(); // stop events
      //set threshold to 0 completely disabling the feature
      clientConn.getRelayPullThread().setNoEventsConnectionResetTimeSec(0);
      Thread.sleep(8000);
      LOG.info("no events, more time then timeout, but feature disabled. Events=" +
          countingConsumer.getNumDataEvents() + "; resets = " + countingConsumer.getNumResets());
      Assert.assertEquals(countingConsumer.getNumResets(), 0);


      // enable the feature, and sleep for timeout
      clientConn.getRelayPullThread().setNoEventsConnectionResetTimeSec(5);
      // now wait with no events
      LOG.info("pause the producer. sleep for 6 sec, should reset");
      TestUtil.sleep(6000);

      LOG.info("Client stats=" + countingConsumer);
      LOG.info("Num resets=" + countingConsumer.getNumResets());
      LOG.info("Event windows generated=" + stats.getNumSysEvents());
      Assert.assertEquals(countingConsumer.getNumResets(), 0, "0 resets");
      Assert.assertEquals(countingConsumer.getNumDataEvents(), stats.getNumDataEvents());

      boolean stopped = r1.shutdown(2000);
      Assert.assertTrue(stopped);
      LOG.info("Relay r1 stopped");
      cr.shutdown();
      LOG.info("Client cr stopped");
      Assert.assertEquals(countingConsumer.getNumDataEvents(), stats
          .getNumDataEvents());
    }
    finally
    {
      cleanup ( new DatabusRelayTestUtil.RelayRunner[] {r1} , cr);
View Full Code Here

Examples of com.linkedin.databus.core.monitoring.mbean.DbusEventsTotalStats

    Assert.assertNotNull(col);
    col.mergeStatsCollectors();
    LOG.info("Merged Stats : " + col.getStatsCollector().getTotalStats());
    LOG.info("C1 Stats : " + c1.getTotalStats());
    LOG.info("C2 Stats : " + c2.getTotalStats());
    DbusEventsTotalStats s = col.getStatsCollector().getTotalStats();
    Assert.assertEquals("Total Events", 8, s.getNumDataEvents());
    Assert.assertEquals("Sys Events", 4, s.getNumSysEvents());
    Assert.assertEquals("Min Scn", 101, s.getMinScn());
    Assert.assertEquals("Max Scn", 205, s.getMaxScn());
    Assert.assertEquals("Num Stats Callback", 1, callback.getCollectorsAddedList().size());
    collector.removeAllStatsCollector();
    Assert.assertEquals("Num Stats Callback", 1, callback.getCollectorsRemovedList()
                                                         .size());
  }
View Full Code Here

Examples of com.linkedin.databus.core.monitoring.mbean.DbusEventsTotalStats

    Assert.assertNotNull(col);
    col.mergeStatsCollectors();
    LOG.info("Merged Stats : " + col.getStatsCollector().getTotalStats());
    LOG.info("C1 Stats : " + c1.getTotalStats());
    LOG.info("C2 Stats : " + c2.getTotalStats());
    DbusEventsTotalStats s = col.getStatsCollector().getTotalStats();
    Assert.assertEquals("Total Events", 8, s.getNumDataEvents());
    Assert.assertEquals("Sys Events", 4, s.getNumSysEvents());
    Assert.assertEquals("Min Scn", 101, s.getMinScn());
    Assert.assertEquals("Max Scn", 205, s.getMaxScn());

    // Verify DB2 collector
    col = collector.getDBStatsCollector("db2");
    Assert.assertNotNull(col);
    col.mergeStatsCollectors();
    LOG.info("Merged Stats : " + col.getStatsCollector().getTotalStats());
    LOG.info("C3 Stats : " + c3.getTotalStats());
    LOG.info("C4 Stats : " + c4.getTotalStats());
    s = col.getStatsCollector().getTotalStats();
    Assert.assertEquals("Total Events", 12, s.getNumDataEvents());
    Assert.assertEquals("Sys Events", 4, s.getNumSysEvents());
    Assert.assertEquals("Min Scn", 301, s.getMinScn());
    Assert.assertEquals("Max Scn", 407, s.getMaxScn());

    // Verify DB3 collector
    col = collector.getDBStatsCollector("db3");
    Assert.assertNotNull(col);
    col.mergeStatsCollectors();
    LOG.info("Merged Stats : " + col.getStatsCollector().getTotalStats());
    LOG.info("C3 Stats : " + c5.getTotalStats());
    LOG.info("C4 Stats : " + c6.getTotalStats());
    s = col.getStatsCollector().getTotalStats();
    Assert.assertEquals("Total Events", 16, s.getNumDataEvents());
    Assert.assertEquals("Sys Events", 4, s.getNumSysEvents());
    Assert.assertEquals("Min Scn", 501, s.getMinScn());
    Assert.assertEquals("Max Scn", 609, s.getMaxScn());

    Assert.assertEquals("Num Stats Callback", 3, callback.getCollectorsAddedList().size());
    collector.removeAllStatsCollector();
    Assert.assertEquals("Num Stats Callback", 3, callback.getCollectorsRemovedList()
                                                         .size());
View Full Code Here

Examples of com.linkedin.databus.core.monitoring.mbean.DbusEventsTotalStats

    String reqPathStr = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
    String reqPathSuffix = reqPathStr.substring(prefix.length());
    // allow DBNAME/partitionid for REST api
    reqPathSuffix = reqPathSuffix.replace('/', ':');

    DbusEventsTotalStats sourceStats = null;
    if (reqPathSuffix.contains(":"))
    {
      // This is a request for a specific partition
      if (null != globalStatsCollector)
      {
        DbusEventsStatisticsCollector s =
            globalStatsCollector.getStatsCollector(reqPathSuffix);
        sourceStats = (s == null) ? null : s.getTotalStats();
      }
    }
    else
    {
      // This is a request at DB aggregate level
      if (null != resourceGroupStatsCollector)
      {
        StatsCollectors<DbusEventsStatisticsCollector> c =
                  resourceGroupStatsCollector.getDBStatsCollector(reqPathSuffix);
        if (null != c)
          sourceStats = c.getStatsCollector().getTotalStats();
      }
    }

    if (null == sourceStats)
    {
      LOG.warn("No Stats for this source=" + request.getName() + ", prefix=" + prefix
          + ", DB/Physical Partition String=" + reqPathSuffix);
      sourceStats = new DbusEventsTotalStats(0, reqPathSuffix, false, false, null);
    }

    writeJsonObjectToResponse(sourceStats, request);

    if (request.getRequestType() == HttpMethod.PUT
View Full Code Here

Examples of com.linkedin.databus.core.monitoring.mbean.DbusEventsTotalStats

      LOG.info("Allocated buffer size=" + prodEventBuffer.getAllocatedSize());
      DbusEventAppender eventProducer = new DbusEventAppender(srcTestEvents, prodEventBuffer,emitterStats,0.600);
      Thread t = new Thread(eventProducer);
      t.start();
      t.join();
      DbusEventsTotalStats stats = emitterStats.getTotalStats();
      LOG.info("minScn=" + prodEventBuffer.getMinScn() + "totalEvents=" + stats.getNumDataEvents());
      //weak assertion ! just check it's not -1 for now
      //TODO! get this assertion to succeed
      //assertTrue(prodEventBuffer.getMinScn()!=-1);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.