Examples of DbusEventsTotalStats


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

  private void processEventsTotalStats(DbusEventsStatisticsCollector statsCollector,
                                       DatabusRequest request) throws IOException
  {
    if (null == statsCollector) return;

    DbusEventsTotalStats totalStatsMBean = statsCollector.getTotalStats();
    if (null == totalStatsMBean) return;

    writeJsonObjectToResponse(totalStatsMBean, request);

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

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

    catch (NumberFormatException nfe)
    {
      throw new InvalidRequestParamValueException("bad srcId:" + request.getName(), prefix, sourceIdStr);
    }

    DbusEventsTotalStats sourceStats = null;
    sourceStats = statsCollector.getSourceStats(sourceId);

    if (null == sourceStats)
    {
      LOG.warn("no stats for this srcId: " + request.getName() + "prefix=" +  prefix + "source ids " + sourceIdStr);
      sourceStats = new DbusEventsTotalStats(0, sourceIdStr, false, false, null);
    }

    writeJsonObjectToResponse(sourceStats, request);

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

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

    //allow DBNAME/partitionid for REST api
    sourceIdStr = sourceIdStr.replace('/', ':');

    DbusEventsStatisticsCollector s = statsCollectors.getStatsCollector(sourceIdStr);
    
    DbusEventsTotalStats sourceStats = (s==null? null : s.getTotalStats();
    if (null == sourceStats)
    {
      LOG.warn("no stats for this srcId: " + request.getName() + "prefix=" +  prefix + "source ids " + sourceIdStr);
      sourceStats = new DbusEventsTotalStats(0, sourceIdStr, false, false, null);
    }

    writeJsonObjectToResponse(sourceStats, request);

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

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

    if (null == statsCollector) return;

    String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME);
    String client = category.substring(prefix.length());

    DbusEventsTotalStats clientStats = statsCollector.getPeerStats(client);
    if (null == clientStats)
    {
      throw new InvalidRequestParamValueException(request.getName(), prefix, client);
    }
View Full Code Here

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

      //Let the writers start
      Thread.sleep(1000);

      long startTimeMs = System.currentTimeMillis();
      long durationInMs = 5*1000; //5s
      DbusEventsTotalStats globalStats = aggregateEventStatsCollectors.getTotalStats();
      long prevValue = 0, prevSize =0;
      while (System.currentTimeMillis() < (startTimeMs+durationInMs))
      {
        //constraint checks;

        //check that readers don't have partial updates or get initialized
        long value = globalStats.getNumDataEvents();
        long size = globalStats.getSizeDataEvents();
        Assert.assertTrue(value > 0);
        if (prevValue > 0 && (value != prevValue))
        {
          Assert.assertTrue(size != prevSize);
          prevValue = value;
          prevSize = size;
        }
        Assert.assertTrue(globalStats.getMaxSeenWinScn() > 0);
        Thread.sleep(RngUtils.randomPositiveInt()%10+1);
      }
      //shut down
      for (StatsWriter sw : nStatsWriters)
      {
        sw.shutdown();
        sw.interrupt();
      }
      //Give a chance to catch up
      Thread.sleep(1000);

      agg.halt();
      aggThread.interrupt();

      //final tally aggregatedEventTotalStats = sum of all individual statsWriter objects in a thread free way

      AggregatedDbusEventsTotalStats myTotalStats = new AggregatedDbusEventsTotalStats(StatsWriter.OWNERID, "mytotal", true, false, null);
      for (DbusEventsStatisticsCollector s:eventStatsCollectors.getStatsCollectors())
      {
        DbusEventsTotalStats writerStat = s.getTotalStats();
        //obviously - we assume this is correct here. we want to check that the updates happen correctly in a concurrent setting
        myTotalStats.mergeStats(writerStat);
      }
      LOG.info("global = " + globalStats.getNumDataEvents() + " Sigma writers=" + myTotalStats.getNumDataEvents());
      Assert.assertEquals("NumDataEvents mismatch for n = " + n,
View Full Code Here

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

              1 * 1024 * 1024, 50000, 30 * 1000, 100, 15 * 1000,
              1, true);
      cr = new ClientRunner(clientConn);
      cr.start();
      log.info("terminating conditions");
      final DbusEventsTotalStats stats = relay1.getInboundEventStatisticsCollector().getTotalStats();
      long totalRunTime = 5000;
      long startTime = System.currentTimeMillis();
      do
      {
        log.info("numDataEvents=" + stats.getNumDataEvents()
            + " numWindows=" + stats.getNumSysEvents() + " size="
            + stats.getSizeDataEvents());
        Thread.sleep(1000);
      }
      while ((System.currentTimeMillis() - startTime) < totalRunTime);

      r1.pause();
      log.info("Sending pause to relay!");
      log.info("numDataEvents=" + stats.getNumDataEvents()
          + " numWindows=" + stats.getNumSysEvents() + " size="
          + stats.getSizeDataEvents());

      TestUtil.assertWithBackoff(new ConditionCheck()
            {
              @Override
              public boolean check()
              {
                boolean success = true;
                for (EventProducer p: relay1.getProducers())
                {
                    if (!(success = success && p.isPaused())) break;
                }
                return success;
              }
            }, "waiting for producers to pause", 4000, log);

      TestUtil.assertWithBackoff(new ConditionCheck()
            {
              @Override
              public boolean check()
              {
                log.debug("countingConsumer.getNumWindows()=" + countingConsumer.getNumWindows());
                return countingConsumer.getNumWindows() == stats.getNumSysEvents();
              }
            }, "wait until client got all events or for maxTimeout", 64 * 1024, log);

      log.info("Client stats=" + countingConsumer);
      log.info("Event windows generated=" + stats.getNumSysEvents());

            cr.shutdown(2000, log);
            log.info("Client cr stopped");
            Assert.assertEquals(countingConsumer.getNumDataEvents(), stats.getNumDataEvents());

      boolean stopped = r1.shutdown(2000);
      Assert.assertTrue(stopped);
      log.info("Relay r1 stopped");
    }
View Full Code Here

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

      Thread.sleep(5*1000);

      r1.pause();

      // wait for r2 to catchup with r1
      final DbusEventsTotalStats stats = relay1
          .getInboundEventStatisticsCollector().getTotalStats();
      final DbusEventsTotalStats stats2 = relay2
          .getInboundEventStatisticsCollector().getTotalStats();
      TestUtil.assertWithBackoff(new ConditionCheck()
      {

        @Override
        public boolean check()
        {
          log.debug("stats2.getNumSysEvents()=" + stats2.getNumSysEvents());
          return stats2.getNumSysEvents() == stats.getNumSysEvents();
        }
      }, "wait for chained relay to catchup", 60000, log);

      log.info("start the client");
      cr.start();

      // wait until client got all events or for maxTimeout;
      TestUtil.assertWithBackoff(new ConditionCheck()
      {

        @Override
        public boolean check()
        {
          log.debug("countingConsumer.getNumWindows()="
              + countingConsumer.getNumWindows());
          return countingConsumer.getNumWindows() == stats.getNumSysEvents();
        }
      }, "wait until client got all events", 10000, log);

      LOG.info("Client stats=" + countingConsumer);
      LOG.info("Event windows generated="
          + stats.getNumSysEvents());
      LOG.info("numDataEvents=" + stats.getNumDataEvents()
          + " numWindows=" + stats.getNumSysEvents() + " size="
          + stats.getSizeDataEvents());
      LOG.info("numDataEvents2=" + stats2.getNumDataEvents()
          + " numWindows2=" + stats2.getNumSysEvents() + " size2="
          + stats2.getSizeDataEvents());

      Assert.assertEquals(stats.getNumDataEvents(), countingConsumer
          .getNumDataEvents());
      Assert.assertEquals(countingConsumer.getNumSources(), 2);
      Assert.assertEquals(stats.getNumSysEvents(), countingConsumer
View Full Code Here

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

      Thread.sleep(5*1000);

      r1.pause();

      final DbusEventsTotalStats stats = relay1
          .getInboundEventStatisticsCollector().getTotalStats();


      log.info("start the client");
      cr.start();

      // wait until client got all events or for maxTimeout;
      TestUtil.assertWithBackoff(new ConditionCheck()
      {

        @Override
        public boolean check()
        {
          log.debug("countingConsumer.getNumWindows()="
              + countingConsumer.getNumWindows());
          return countingConsumer.getNumWindows() == stats.getNumSysEvents();
        }
      }, "wait until client got all events", 10000, log);

      LOG.info("Client stats=" + countingConsumer);
      LOG.info("Event windows generated="
          + stats.getNumSysEvents());
      LOG.info("numDataEvents=" + stats.getNumDataEvents()
          + " numWindows=" + stats.getNumSysEvents() + " size="
          + stats.getSizeDataEvents());

      Assert.assertEquals(stats.getNumDataEvents(), countingConsumer
          .getNumDataEvents());
      Assert.assertEquals(countingConsumer.getNumSources(), 2);
      Assert.assertEquals(stats.getNumSysEvents(), countingConsumer
          .getNumWindows());
    }
    finally
    {
      cleanup ( new DatabusRelayTestUtil.RelayRunner[] {r1,r2} , cr);
View Full Code Here

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

      r1.pause();

      // wait until client got all events or for maxTimeout;
      long maxTimeOutMs = 5 * 1000;
      long startTime = System.currentTimeMillis();
      DbusEventsTotalStats stats = relay1
          .getInboundEventStatisticsCollector().getTotalStats();
      while (countingConsumer.getNumWindows() < stats.getNumSysEvents())
      {
        Thread.sleep(500);
        // LOG.info("Client stats=" + countingConsumer);
        // LOG.error("numDataEvents=" +
        // stats.getNumDataEvents() + " numWindows=" +
        // stats.getNumSysEvents() + " size=" +
        // stats.getSizeDataEvents());
        if ((System.currentTimeMillis() - startTime) > maxTimeOutMs)
        {
          break;
        }
      }

      LOG.info("Client stats=" + countingConsumer);
      LOG.info("Event windows generated="
          + stats.getNumSysEvents());
      LOG.info("numDataEvents=" + stats.getNumDataEvents()
          + " numWindows=" + stats.getNumSysEvents() + " size="
          + stats.getSizeDataEvents());

      Assert.assertEquals(stats.getNumDataEvents(), countingConsumer.getNumDataEvents());
      Assert.assertEquals(countingConsumer.getNumSources(), 2);
      Assert.assertEquals(stats.getNumSysEvents(), countingConsumer.getNumWindows());

    }
    catch (Exception e)
    {
      LOG.error("Exception: " + e);
View Full Code Here

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

      r1.pause();

      // wait until client got all events or for maxTimeout;
      long maxTimeOutMs = 5 * 1000;
      long startTime = System.currentTimeMillis();
      DbusEventsTotalStats stats = relay1
          .getInboundEventStatisticsCollector().getTotalStats();
      while (countingConsumer.getNumWindows() < stats.getNumSysEvents())
      {
        Thread.sleep(500);
        // LOG.info("Client stats=" + countingConsumer);
        // LOG.error("numDataEvents=" +
        // stats.getNumDataEvents() + " numWindows=" +
        // stats.getNumSysEvents() + " size=" +
        // stats.getSizeDataEvents());
        if ((System.currentTimeMillis() - startTime) > maxTimeOutMs)
        {
          break;
        }
      }

      LOG.info("Client stats=" + countingConsumer);
      LOG.info("Event windows generated="
          + stats.getNumSysEvents());
      LOG.info("numDataEvents=" + stats.getNumDataEvents()
          + " numWindows=" + stats.getNumSysEvents() + " size="
          + stats.getSizeDataEvents());

      Assert.assertTrue(countingConsumer.getNumSources() == 1);
      Assert.assertTrue(stats.getNumSysEvents() == countingConsumer
          .getNumWindows());
       Assert.assertTrue(stats.getNumDataEvents() == 2 * countingConsumer
            .getNumDataEvents());


    }
    catch (Exception e)
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.