Package com.cloudera.flume.reporter

Examples of com.cloudera.flume.reporter.ReportManager


  }
 
  @Test
  public void testReports() throws TException, IOException {
    FlumeConfiguration.createTestableConfiguration();
    ReportManager rptMan = ReportManager.get();
    rptMan.clear();
    FlumeConfiguration.get().set(FlumeConfiguration.WEBAPPS_PATH,
        "build/webapps");
    FlumeConfiguration.get().set(FlumeConfiguration.MASTER_STORE, "memory");
    FlumeConfiguration.get().setInt(FlumeConfiguration.MASTER_HEARTBEAT_PORT, 55556);
    FlumeMaster master = new FlumeMaster(new CommandManager(),
        new ConfigManager(), new StatusManager(), new MasterAckManager(),
        FlumeConfiguration.get());
    MasterClientServer delegate = new MasterClientServer(master, cfg);
    delegate.masterRPC.serve();
   
    ReportEvent r = new ReportEvent("foo");
    r.setStringMetric("bar", "baz");
    Map<String, ReportEvent> rptMap = new HashMap<String, ReportEvent>();
    rptMap.put("test-report", r);
    delegate.putReports(rptMap);
   
    Map<String, Reportable> reportables = rptMan.getReportables();
   
    delegate.stop();
   
    assertEquals(1, reportables.size());
    assertNotNull(reportables.get("test-report"));
View Full Code Here


   * in Reportable objects.
   */
  public void putReports(Map<String, ReportEvent> reports) {
    Preconditions.checkNotNull(reports,
        "putReports called with null report map");
    ReportManager rptManager = ReportManager.get();
    for (final Entry<String, ReportEvent> r : reports.entrySet()) {
      rptManager.add(new Reportable() {

        @Override
        public String getName() {
          return r.getKey();
        }
View Full Code Here

  @Override
  public Map<CharSequence, AvroFlumeReport> getAllReports()
      throws AvroRemoteException {
    Map<CharSequence, AvroFlumeReport> retMap = new HashMap<CharSequence, AvroFlumeReport>();

    ReportManager reportManager = ReportManager.get();
    Map<String, Reportable> reports = reportManager.getReportables();

    for (Entry<String, Reportable> e : reports.entrySet()) {
      AvroFlumeReport report = reportToAvro(e.getValue().getMetrics());
      retMap.put(e.getKey(), report);
    }
View Full Code Here

   * Avro interface: returns a map of reports in serializable form
   */
  @Override
  public AvroFlumeReport getReportByName(CharSequence reportName)
      throws AvroRemoteException {
    ReportManager reportManager = ReportManager.get();
    Map<String, Reportable> reports = reportManager.getReportables();
    if (reports.containsKey(reportName.toString())) {
      return reportToAvro(reports.get(reportName.toString()).getMetrics());
    }
    return null;
  }
View Full Code Here

   * Thrift interface: returns a serializable report with given name or null if
   * report doesn't exist
   */
  @Override
  public ThriftFlumeReport getReportByName(String reportName) throws TException {
    ReportManager reportManager = ReportManager.get();
    Map<String, Reportable> reports = reportManager.getReportables();
    if (reports.containsKey(reportName)) {
      return reportToThrift(reports.get(reportName).getMetrics());
    }

    return null;
View Full Code Here

   */
  @Override
  public Map<String, ThriftFlumeReport> getAllReports() throws TException {
    Map<String, ThriftFlumeReport> retMap = new HashMap<String, ThriftFlumeReport>();

    ReportManager reportManager = ReportManager.get();
    Map<String, Reportable> reports = reportManager.getReportables();

    for (Entry<String, Reportable> e : reports.entrySet()) {
      ThriftFlumeReport report = reportToThrift(e.getValue().getMetrics());
      retMap.put(e.getKey(), report);
    }
View Full Code Here

  /**
   * This gets reports and outputs them to std err in csv format.
   */
  public static void dumpReports() {
    ReportManager rman = ReportManager.get();
    SortedMap<String, Reportable> sorted = new TreeMap<String, Reportable>(rman
        .getReportables());
    for (Map.Entry<String, Reportable> ent : sorted.entrySet()) {
      String params = ent.getKey();
      ReportEvent r = ent.getValue().getMetrics();
      System.out.println(new String(r.toString()));
View Full Code Here

  /**
   * This gets reports and outputs them to std err in csv format.
   */
  public static void dumpReports() {
    ReportManager rman = ReportManager.get();
    SortedMap<String, Reportable> sorted = new TreeMap<String, Reportable>(
        rman.getReportables());
    for (Map.Entry<String, Reportable> ent : sorted.entrySet()) {
      String params = ent.getKey();
      ReportEvent r = ent.getValue().getMetrics();
      System.out.println(new String(r.toString()));
      System.err.print(new Date(r.getTimestamp()) + ",");
View Full Code Here

  @Override
  public Map<CharSequence, AvroFlumeReport> getAllReports()
      throws AvroRemoteException {
    Map<CharSequence, AvroFlumeReport> retMap = new HashMap<CharSequence, AvroFlumeReport>();

    ReportManager reportManager = ReportManager.get();
    Map<String, Reportable> reports = reportManager.getReportables();

    for (Entry<String, Reportable> e : reports.entrySet()) {
      AvroFlumeReport report = reportToAvro(e.getValue().getMetrics());
      retMap.put(e.getKey(), report);
    }
View Full Code Here

   * Avro interface: returns a map of reports in serializable form
   */
  @Override
  public AvroFlumeReport getReportByName(CharSequence reportName)
      throws AvroRemoteException {
    ReportManager reportManager = ReportManager.get();
    Map<String, Reportable> reports = reportManager.getReportables();
    if (reports.containsKey(reportName.toString())) {
      return reportToAvro(reports.get(reportName.toString()).getMetrics());
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of com.cloudera.flume.reporter.ReportManager

Copyright © 2018 www.massapicom. 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.