Package com.errplane.util

Examples of com.errplane.util.ReportHelper


        List<ReportHelper> udpReports = new ArrayList<ReportHelper>();
        List<ReportHelper> udpAggregates = new ArrayList<ReportHelper>();
        List<ReportHelper> udpSums = new ArrayList<ReportHelper>();

        while (!reportQueue.isEmpty() && (numRemoved < 200)) {
          ReportHelper rh = reportQueue.remove();
          numRemoved++;

          // System.out.printf("type: %s, report type: %s\n", rh.getType(), rh.getReportType());

          switch (rh.getType()) {
          case HTTP:
            httpReports.add(rh);
            break;
          case UDP:
            if (rh.getReportType().equals("r"))
              udpReports.add(rh);
            else if (rh.getReportType().equals("t"))
              udpAggregates.add(rh);
            else if (rh.getReportType().equals("c"))
              udpSums.add(rh);
            else
              throw new IllegalArgumentException("Invalid report type " + rh.getReportType());
            break;
          default:
            throw new IllegalArgumentException("Unkown type " + rh.getType());
          }
        }

        if (httpReports.size() > 0) {
          sendHttpReport(httpReports);
View Full Code Here


  public static ExceptionData getExceptionData(String c, String a, String u) {
    return new ExceptionData(c, a, u, "");
  }

  private static void addReportHelper(String name, double val, String context, Map<String, String> dimensions) {
    ReportHelper rh = new ReportHelper(name, "", ReportHelper.ReportType.HTTP, database, api);
    rh.setReportValue(val);
    rh.setContext(context);
    rh.setDimensions(dimensions);
    reportQueue.add(rh);
    reportCount.addAndGet(1);
  }
View Full Code Here

    }

    // example
    // {"a":"962cdc9b-15e7-4b25-9a0d-24a45cfc6bc1","d":"app4you2lovestaging","o":"t","w":[{"n":"some_aggregate","p":[{"c":"","d":null,"v":30.091186058528706}]}]}

    ReportHelper rh = new ReportHelper(name, reportType, ReportHelper.ReportType.UDP, database, api);
    rh.setReportValue(value);
    rh.setContext(context);
    rh.setDimensions(dimensions);
    reportQueue.add(rh);
    reportCount.addAndGet(1);

    return true;
  }
View Full Code Here

    if (!reportQueue.isEmpty() && (errplaneUrl != null)) {
      int bytesWritten = 0;
      HTTPPostHelper postHelper = new HTTPPostHelper();
      try {
        while (!reportQueue.isEmpty() && (numRemoved < 200)) {
          ReportHelper rh = reportQueue.remove();
          numRemoved++;
          String rptBody = rh.getReportBody();
          bytesWritten += rptBody.length() + 1;
          OutputStream os = postHelper.getOutputStream(errplaneUrl, bytesWritten);
          os.write(rptBody.getBytes());
          os.write('\n');
          if (!postHelper.sendPost(bytesWritten)) {
View Full Code Here

  public static ExceptionData getExceptionData(String c, String a, String u) {
    return new ExceptionData(c, a, u);
  }

  private static void addReportHelper(String name, double val, String context, Map<String, String> dimensions) {
    ReportHelper rh = new ReportHelper(name);
    rh.setReportValue(val);
    rh.setContext(context);
    rh.setDimensions(dimensions);
    reportQueue.add(rh);
    reportCount.addAndGet(1);
  }
View Full Code Here

TOP

Related Classes of com.errplane.util.ReportHelper

Copyright © 2015 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.