Package org.rhq.core.domain.measurement

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


                    SimpleValue xaTransactionMetaValue = (SimpleValue) xaTransactionProp.getValue();
                    Boolean xaTransactionValue = (xaTransactionMetaValue != null) ? (Boolean) xaTransactionMetaValue
                        .getValue() : null;
                    boolean isXa = (xaTransactionValue != null && xaTransactionValue);
                    String transactionType = (isXa) ? "XA" : "Local";
                    report.addData(new MeasurementDataTrait(request, transactionType));
                } else {
                    uncollectedMetrics.add(request);
                }
            } catch (Exception e) {
                log.error("Failed to collect metric for " + request, e);
View Full Code Here


                    case MEASUREMENT: {
                        mr.addData(new MeasurementDataNumeric(request, Double.valueOf(value)));
                        break;
                    }
                    case TRAIT: {
                        mr.addData(new MeasurementDataTrait(request, value));
                        break;
                    }
                    default: {
                        break;
                    }
View Full Code Here

        when(asConnection.execute(readAttribute(address, requestName))).thenReturn(result(traitValue));
        sampleComponent.getValues(report, requests);

        Set<MeasurementDataTrait> traits = report.getTraitData();
        assertEquals(traits.size(), 1);
        MeasurementDataTrait trait = traits.iterator().next();
        assertEquals(trait.getName(), requestName);
        assertEquals(trait.getValue(), traitValue);
    }
View Full Code Here

        when(asConnection.execute(resolveExpression(expressionValue))).thenReturn(result(traitValue));
        sampleComponent.getValues(report, requests);

        Set<MeasurementDataTrait> traits = report.getTraitData();
        assertEquals(traits.size(), 1);
        MeasurementDataTrait trait = traits.iterator().next();
        assertEquals(trait.getName(), requestName);
        assertEquals(trait.getValue(), traitValue);
    }
View Full Code Here

                LOG.warn("Measurement request: " + request.getName()
                    + " did not return a numeric value from the Profile Service", e);
            }
            break;
        case TRAIT:
            MeasurementDataTrait dataTrait = new MeasurementDataTrait(request, String.valueOf(simpleValue.getValue()));
            report.addData(dataTrait);
            break;
        default:
            throw new IllegalStateException("Unsupported measurement data type: " + dataType);
View Full Code Here

                log.warn("Measurement request: " + request.getName()
                    + " did not return a numeric value from the Profile Service", e);
            }
            break;
        case TRAIT:
            MeasurementDataTrait dataTrait = new MeasurementDataTrait(request, String.valueOf(value));
            report.addData(dataTrait);
            break;
        default:
            throw new IllegalStateException("Unsupported measurement data type: " + dataType);
        }
View Full Code Here

            long currentTime = System.currentTimeMillis();
            for (MeasurementScheduleRequest request : metrics) {
                try {
                    if (request.getName().equals("lastSuccessfulBuildNumber") && lastSuccessfulBuild != null) {
                        report.addData(new MeasurementDataTrait(request, lastSuccessfulBuild.getString("number")));
                    } else if (request.getName().equals("lastSuccessfulBuildTime") && lastSuccessfulBuild != null) {
                        report.addData(new MeasurementDataTrait(request, new Date(lastSuccessfulBuild
                            .getLong("timestamp")).toString()));
                    } else if (request.getName().equals("lastSuccessfulBuildElapsedTime")
                        && lastSuccessfulBuild != null) {
                        report.addData(new MeasurementDataNumeric(request, (currentTime - lastSuccessfulBuild
                            .getLong("timestamp")) / 1000d));
                    } else if (request.getName().equals("lastBuildNumber") && lastBuild != null) {
                        report.addData(new MeasurementDataTrait(request, lastBuild.getString("number")));
                    } else if (request.getName().equals("lastBuildTime") && lastBuild != null) {
                        report.addData(new MeasurementDataTrait(request, new Date(lastBuild.getLong("timestamp"))
                            .toString()));
                    } else if (request.getName().equals("lastBuildElapsedTime") && lastBuild != null) {
                        report.addData(new MeasurementDataNumeric(request, (currentTime - lastBuild
                            .getLong("timestamp")) / 1000d));
                    } else if (request.getName().equals("lastBuildResult") && lastBuild != null) {
                        report.addData(new MeasurementDataTrait(request, lastBuild.getString("result")));
                    } else if (request.getName().equals("healthScore") && healthReport != null) {
                        report.addData(new MeasurementDataNumeric(request, healthReport.getDouble("score") / 100d));
                    } else if (request.getName().equals("lastBuildDuration") && lastBuild != null) {
                        report.addData(new MeasurementDataNumeric(request, lastBuild.getDouble("duration")));
                    }
View Full Code Here

                 if (schedule.getDataType()== DataType.TRAIT) {
                     String val = values.get(metricName);
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Collected BMX metric [" + metricName + "], value = " + val);
                     }
                     MeasurementDataTrait mdt = new MeasurementDataTrait(schedule,val);                    
                     report.addData(mdt);
                 } else {
                    Double val = Double.valueOf(values.get(metricName));
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Collected BMX metric [" + metricName + "], value = " + val);
View Full Code Here

                if (request.getDataType() == DataType.MEASUREMENT) {
                    Number number = (Number) value;
                    report.addData(new MeasurementDataNumeric(request, number.doubleValue()));
                } else if (request.getDataType() == DataType.TRAIT) {
                    report.addData(new MeasurementDataTrait(request, value.toString()));
                }
            } catch (RuntimeException e) {
                log.error("Failed to obtain metric '" + requestName + "'.", e);
            }
        }
View Full Code Here

            String requestName = request.getName();
            if (requestName.equals(Util.NAME_PROPERTY) || requestName.equals(Util.DEFAULT_HOST_NAME_PROPERTY) ||
                requestName.equals(Util.PORT_OFFSET_PROPERTY)) {
               
                String value = config.getSimpleValue(requestName, null);
                report.addData(new MeasurementDataTrait(request, value));
            }
        }
    }
View Full Code Here

TOP

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

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.