Package org.rhq.core.domain.measurement

Examples of org.rhq.core.domain.measurement.MeasurementDataNumeric


      // actually need to collect
      try {
        Number value = new Integer(1); // dummy measurement value -
        // this should come from the
        // managed resource
        report.addData(new MeasurementDataNumeric(request, value.doubleValue()));
      } catch (Exception e) {
        LOG.error("Failed to obtain measurement [" + name   + "]. Cause: " + e); //$NON-NLS-1$ //$NON-NLS-2$
      }
    }
View Full Code Here


        Object metric = view.getMetric(getConnection(),
            getComponentType(), this.getComponentIdentifier(),
            name, valueMap);

        if (metric instanceof Double) {
          report.addData(new MeasurementDataNumeric(request, (Double) metric));
        }
        else if (metric instanceof Integer ){
          report.addData(new MeasurementDataNumeric(request, new Double(((Integer)metric).doubleValue())));
        }
        else if (metric instanceof Long){
          report.addData(new MeasurementDataNumeric(request, new Double(((Long)metric).longValue())));
        }
        else {
          LOG.error("Metric value must be a numeric value"); //$NON-NLS-1$
        }
      }
View Full Code Here

          } else {
            if (request
                .getName()
                .equals(
                    PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
              report.addData(new MeasurementDataNumeric(request,
                  (Double) metricReturnObject));
            } else {
              if (request
                  .getName()
                  .equals(
                      PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
                if (((String) metricReturnObject)
                    .equals("ACTIVE")) {
                  report.addData(new MeasurementDataTrait(
                      request, "UP"));
                } else {
                  report.addData(new MeasurementDataTrait(
                      request, "DOWN"));
                }
              } else {
                if (request
                    .getName()
                    .equals(
                        PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
                  report.addData(new MeasurementDataNumeric(
                      request,
                      (Double) metricReturnObject));
                }
              }
View Full Code Here

         return;

      name = name.substring(INTERNAL_SIZE);

      PluginStats stats = PluginStats.getInstance();
      MeasurementDataNumeric data;
      Double val;
      if (name.equals("mgmtRequests")) {
         val = (double) stats.getRequestCount();
      } else if (name.equals("requestTime")) {
         val = (double) stats.getRequestTime();
      } else if (name.equals("maxTime")) {
         val = (double) stats.getMaxTime();
      } else
         val = Double.NaN;

      data = new MeasurementDataNumeric(req, val);
      report.addData(data);
   }
View Full Code Here

      report.addData(data);
   }

   private void addMetric2Report(MeasurementReport report, MeasurementScheduleRequest req, Object val) {
      Double d = Double.parseDouble(getStringValue(val));
      MeasurementDataNumeric data = new MeasurementDataNumeric(req, d);
      report.addData(data);
   }
View Full Code Here

            if (attribute != null) {
              processed = (Integer) attribute.refresh();
            }
            success = processed.intValue();
            counter += processed.intValue();
            report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));
          } else if (metricName.equals(FAILED_METRIC_NAME)) {
            EmsAttribute attribute = this.bean.getAttribute(actionName + " " + FAILED_PROCESSED);
              Integer processed = new Integer(0);
              if (attribute != null) {
                processed = (Integer) attribute.refresh();
              }
              failed = processed.intValue();
              counter += processed.intValue();
            report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));
          } else if (metricName.equals(PROCESSINGTIME_METRIC_NAME)) {
            EmsAttribute attribute = this.bean.getAttribute(actionName + " " + PROCESSING_TIME);
            Double processed = (Double) attribute.refresh();
            if (processed != null) {
                processed = new Double(processed.doubleValue() / 1000000);
              report.addData(new MeasurementDataNumeric(request, processed));
            } else {
              report.addData(new MeasurementDataNumeric(request, new Double(0)));
            }
          } else if (metricName.equals(BYTESPROCESSED_METRIC_NAME)) {
            EmsAttribute attribute = this.bean.getAttribute(actionName + " " + OVERALL_BYTES_PROCESSED);
            Long bytesProcessed = new Long(0);
            if (attribute != null) {
              bytesProcessed = (Long) attribute.refresh();
              counterBytesProcessed = bytesProcessed.longValue();
            }
            report.addData(new MeasurementDataNumeric(request, new Double(bytesProcessed.doubleValue())));
          } else if (metricName.equals(BYTESFAILED_METRIC_NAME)) {
            EmsAttribute attribute = this.bean.getAttribute(actionName + " " + OVERALL_BYTES_FAILED);
            Long bytesFailed = new Long(0);
            if (attribute != null) {
              bytesFailed = (Long) attribute.refresh();
              counterBytesFailed += bytesFailed.longValue();
            }
            report.addData(new MeasurementDataNumeric(request, new Double(bytesFailed.doubleValue())));           
          }
        }
      for (MeasurementScheduleRequest request : requests) {
          String metricName = request.getName();
          if (metricName.equals (OVERALL_METRIC_NAME)) {
            report.addData(new MeasurementDataNumeric(request, new Double(counter)));           
          } else if (metricName.equals(OVERALL_MINUTE_METRIC_NAME)) {
            report.addData(new MeasurementDataNumeric(request, new Double(counter)));           
          } else if (metricName.equals(SUCCESS_MINUTE_METRIC_NAME)) {
            report.addData(new MeasurementDataNumeric(request, new Double(success)));                       
          } else if (metricName.equals(FAILED_MINUTE_METRIC_NAME)) {
            report.addData(new MeasurementDataNumeric(request, new Double(failed)));                       
          } else if (metricName.equals(OVERALL_BYTES_METRIC_NAME)) {
            report.addData(new MeasurementDataNumeric(request, new Double(counterBytesProcessed + counterBytesFailed)));
          }
      }
    }
View Full Code Here

        for (MeasurementScheduleRequest request : requests) {
          String metricName = request.getName();
          if (metricName.equals(OVERALL_MESSAGE_METRIC)) {
            EmsAttribute attribute = getEmsBean().getAttribute(OVERALL_MESSAGE_COUNT);
            overallMessages = (Integer) attribute.refresh();
            report.addData(new MeasurementDataNumeric(request, new Double(overallMessages.doubleValue())));
          } else if (metricName.equals(OVERALL_TIME_PROCESSED_METRIC)) {
            EmsAttribute attribute = getEmsBean().getAttribute(OVERALL_TIME_PROCESSED);
            Long overallTimeProcessed = (Long) attribute.refresh();
            if (overallTimeProcessed != null) {
              Double timeProcessed = new Double(overallTimeProcessed.doubleValue() / 1000000);
              report.addData(new MeasurementDataNumeric(request, timeProcessed));
            } else {
              report.addData(new MeasurementDataNumeric(request, new Double(0)));
            }
          } else if (metricName.equals(OVERALL_BYTES_PROCESSED_METRIC)) {
            EmsAttribute attribute = getEmsBean().getAttribute(OVERALL_BYTES_PROCESSED);
            Long processed = new Long(0);
            if (attribute != null) {
              processed = (Long) attribute.refresh();
              bytesProcessed = processed.longValue();
            }
            report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));
          } else if (metricName.equals(OVERALL_BYTES_FAILED_METRIC)) {
            EmsAttribute attribute = getEmsBean().getAttribute(OVERALL_BYTES_FAILED);
            Long processed = new Long(0);
            if (attribute != null) {
              processed = (Long) attribute.refresh();
              bytesFailed = processed.longValue();
            }
            report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));           
          } else if (metricName.equals(OVERALL_BYTES_METRIC)) {
            EmsAttribute attribute = getEmsBean().getAttribute(OVERALL_BYTES_COUNT);
            Long processed = new Long(0);
            if (attribute != null) {
              processed = (Long) attribute.refresh();
            }
            report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));
          }
        }

        for (MeasurementScheduleRequest request : requests) {
          String metricName = request.getName();
          if (metricName.equals(OVERALL_MINUTE_METRIC_NAME)) {
            report.addData(new MeasurementDataNumeric(request, new Double(overallMessages.doubleValue())));
          }
        }
    }
View Full Code Here

        Buckets buckets = new Buckets(beginTime, endTime);

        MeasurementScheduleRequest request = new MeasurementScheduleRequest(dynamicSchedule);
        MeasurementReport report = new MeasurementReport();
        report.addData(new MeasurementDataNumeric(buckets.get(0) + 10, request, 1.1));
        report.addData(new MeasurementDataNumeric(buckets.get(0) + 20, request, 2.2));
        report.addData(new MeasurementDataNumeric(buckets.get(0) + 30, request, 3.3));
        report.addData(new MeasurementDataNumeric(buckets.get(59) + 10, request, 4.4));
        report.addData(new MeasurementDataNumeric(buckets.get(59) + 20, request, 5.5));
        report.addData(new MeasurementDataNumeric(buckets.get(59) + 30, request, 6.6));

        dataManager.mergeMeasurementReport(report);
        waitForRawInserts();

        List<MeasurementDataNumericHighLowComposite> actualData = findDataForContext(getOverlord(),
View Full Code Here

        Buckets buckets = new Buckets(beginTime, endTime);

        MeasurementScheduleRequest request = new MeasurementScheduleRequest(dynamicSchedule);
        MeasurementReport report = new MeasurementReport();
        report.addData(new MeasurementDataNumeric(buckets.get(0) + 10, request, 1.1));
        report.addData(new MeasurementDataNumeric(buckets.get(0) + 20, request, 2.2));
        report.addData(new MeasurementDataNumeric(buckets.get(0) + 30, request, 3.3));
        report.addData(new MeasurementDataNumeric(buckets.get(59) + 10, request, 4.4));
        report.addData(new MeasurementDataNumeric(buckets.get(59) + 20, request, 5.5));
        report.addData(new MeasurementDataNumeric(buckets.get(59) + 30, request, 6.6));

        dataManager.mergeMeasurementReport(report);
        waitForRawInserts();

        MeasurementAggregate actual = dataManager.getMeasurementAggregate(getOverlord(), dynamicSchedule.getId(),
View Full Code Here

                public Set<MeasurementData> answer(InvocationOnMock invocation) throws Throwable {
                    Set<MeasurementScheduleRequest> requests = (Set<MeasurementScheduleRequest>) invocation.getArguments()[1];

                    Set<MeasurementData> ret = new HashSet<MeasurementData>();
                    for(MeasurementScheduleRequest req : requests) {
                        ret.add(new MeasurementDataNumeric(System.currentTimeMillis(), req, (double) System.nanoTime()));
                    }

                    return ret;
                }
            });
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.measurement.MeasurementDataNumeric

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.