Examples of MeasurementAggregate


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

         */
        if (schedule.getDefinition().getNumericType() != NumericType.DYNAMIC) {
            throw new BaselineCreationException("Baseline calculation is only valid for a dynamic measurement");
        }

        MeasurementAggregate agg = dataManager.getMeasurementAggregate(subjectManager.getOverlord(), schedule.getId(),
            startDate, endDate);

        // attach the entity, so we can find the baseline
        schedule = entityManager.merge(schedule);

        MeasurementBaseline baseline = null;
        if (save && (schedule.getBaseline() != null)) {
            /*
             * If saving, make sure we're updating the existing one, if it exists
             */
            baseline = schedule.getBaseline();
        } else {
            /*
             * Otherwise, if we're not saving or if the the schedule doesn't have a current baseline, we create a new
             * baseline object
             */
            baseline = new MeasurementBaseline();

            if (save) {
                /*
                 * But, if we *are* in save mode, then set the relationship so when we merge the schedule below it
                 * persists this new baseline too
                 */
                baseline.setSchedule(schedule);
            }
        }

        baseline.setUserEntered(userEntered);
        baseline.setMean(agg.getAvg());
        baseline.setMin(agg.getMin());
        baseline.setMax(agg.getMax());

        if (save) {
            entityManager.persist(baseline);
            entityManager.merge(schedule);
        }
View Full Code Here

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

    }

    private MeasurementBaseline calculateBaselineForGroup(int groupId, int definitionId, boolean userEntered,
        long startDate, long endDate, boolean save) throws DataNotAvailableException, BaselineCreationException {

        MeasurementAggregate agg = dataManager.getAggregate(subjectManager.getOverlord(), groupId, definitionId,
            startDate, endDate);

        Subject overlord = subjectManager.getOverlord();
        List<Integer> resourceIds = resourceManager.findImplicitResourceIdsByResourceGroup(groupId);
        List<MeasurementSchedule> schedules = measurementScheduleManager.findSchedulesByResourceIdsAndDefinitionId(
            overlord, ArrayUtils.unwrapCollection(resourceIds), definitionId);

        MeasurementBaseline baseline = null;
        for (MeasurementSchedule schedule : schedules) {
            // attach the entity, so we can find the baseline
            schedule = entityManager.merge(schedule);

            if (save && (schedule.getBaseline() != null)) {
                /*
                 * If saving, make sure we're updating the existing one, if it exists
                 */
                baseline = schedule.getBaseline();
            } else {
                /*
                 * Otherwise, if we're not saving or if the the schedule doesn't have a current baseline, we create a new
                 * baseline object
                 */
                baseline = new MeasurementBaseline();

                if (save) {
                    /*
                     * But, if we *are* in save mode, then set the relationship so when we merge the schedule below it
                     * persists this new baseline too
                     */
                    baseline.setSchedule(schedule);
                }
            }

            baseline.setUserEntered(userEntered);
            baseline.setMean(agg.getAvg());
            baseline.setMin(agg.getMin());
            baseline.setMax(agg.getMax());

            if (save) {
                entityManager.persist(baseline);
                entityManager.merge(schedule);
            }
View Full Code Here

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

            }

            MetricsServer metricsServer = storageClientManager.getMetricsServer();
            AggregateNumericMetric summary = metricsServer.getSummaryAggregate(scheduleId, startTime, endTime);

            return new MeasurementAggregate(summary.getMin(), summary.getAvg(), summary.getMax());
        } finally {
            stopwatch.stop();
            log.debug("Finished loading measurement aggregate in " + stopwatch.elapsed(TimeUnit.MILLISECONDS));
        }
    }
View Full Code Here

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

            criteria);

        MetricsServer metricsServer = storageClientManager.getMetricsServer();
        AggregateNumericMetric summary = metricsServer.getSummaryAggregate(map(schedules), startTime, endTime);

        return new MeasurementAggregate(summary.getMin(), summary.getAvg(), summary.getMax());
    }
View Full Code Here

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

        MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
        boolean isHtml = mediaType.equals(MediaType.TEXT_HTML_TYPE);

        MeasurementSchedule schedule = obtainSchedule(scheduleId, false, DataType.MEASUREMENT);

        MeasurementAggregate aggr = dataManager.getMeasurementAggregate(caller, scheduleId, startTime, endTime);
        MetricAggregate res = new MetricAggregate(scheduleId, aggr.getMin(),aggr.getAvg(),aggr.getMax());

        int definitionId = schedule.getDefinition().getId();
        List<List<MeasurementDataNumericHighLowComposite>> listList = dataManager.findDataForResource(caller,
                schedule.getResource().getId(), new int[]{definitionId}, startTime, endTime, dataPoints);
View Full Code Here

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

        MeasurementDefinition definition = definitionManager.getMeasurementDefinition(caller,definitionId);
        if (definition==null) {
            throw new StuffNotFoundException("There is no definition with id " + definitionId);
        }

        MeasurementAggregate aggr = dataManager.getAggregate(caller, groupId, definitionId, startTime, endTime);
        MetricAggregate res = new MetricAggregate(definitionId, aggr.getMin(),aggr.getAvg(),aggr.getMax());
        res.setGroup(true);

        List<List<MeasurementDataNumericHighLowComposite>> listList = dataManager.findDataForCompatibleGroup(caller,
                groupId,definitionId,startTime,endTime,dataPoints);
View Full Code Here

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

                throw new StuffNotFoundException("Schedule with id " + scheduleId);
            int definitionId = sched.getDefinition().getId();
            List<List<MeasurementDataNumericHighLowComposite>> listList =
                dataManager.findDataForContext(caller, EntityContext.forResource(sched.getResource().getId()),definitionId,startTime,endTime,dataPoints);
            if (!listList.isEmpty()) {
                MeasurementAggregate measurementAggregate = dataManager.getMeasurementAggregate(caller,scheduleId,startTime,endTime);
                List<MeasurementDataNumericHighLowComposite> list = listList.get(0);
                MetricAggregate res = new MetricAggregate(scheduleId,measurementAggregate.getMin(),measurementAggregate.getAvg(),measurementAggregate.getMax());
                boolean isHtml = mediaType.equals(MediaType.TEXT_HTML_TYPE);
                res = fillInDatapoints(res, list, scheduleId, hideEmpty, isHtml);
                resList.add(res);
            }
            else
View Full Code Here

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

            putToCache(sched.getId(),MeasurementSchedule.class,sched);
        }
        List<MetricAggregate> ret = new ArrayList<MetricAggregate>(schedules.size());

        for (MeasurementSchedule schedule: schedules) {
            MeasurementAggregate aggr = dataManager.getMeasurementAggregate(caller,schedule.getId(),startTime,endTime);
            MetricAggregate res = new MetricAggregate(schedule.getId(), aggr.getMin(),aggr.getAvg(),aggr.getMax());

            if (includeDataPoints) {
                int definitionId = schedule.getDefinition().getId();
                List<List<MeasurementDataNumericHighLowComposite>> listList = dataManager.findDataForResource(caller,
                        schedule.getResource().getId(), new int[]{definitionId}, startTime, endTime, dataPoints);
View Full Code Here

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

        Set<MeasurementDefinition> definitions = group.getResourceType().getMetricDefinitions();

        List<MetricDefinitionAggregate> ret = new ArrayList<MetricDefinitionAggregate>(definitions.size());
        for (MeasurementDefinition def : definitions) {
            if (def.getDataType()==DataType.MEASUREMENT) {
                MeasurementAggregate aggregate = dataManager.getAggregate(caller, groupId, def.getId(), startTime, endTime);
                MetricDefinitionAggregate res = new MetricDefinitionAggregate(def.getId(), aggregate.getMin(),aggregate.getAvg(),aggregate.getMax());
                ret.add(res);
            }
        }
        return ret;
    }
View Full Code Here

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

                    MSG.view_adminTopology_storageNodes_load_dataDiskUsedPercentageName(),
                    MSG.view_adminTopology_storageNodes_load_dataDiskUsedPercentageHover(),
                    KEY_DATA_DISK_SPACE_PERCENTAGE));

            if (loadComposite.getFreeDiskToDataSizeRatio() != null) {
                MeasurementAggregate aggregate = loadComposite.getFreeDiskToDataSizeRatio();
                NumberFormat nf = NumberFormat.getFormat("0.0");
                ListGridRecord record = new ListGridRecord();
                record.setAttribute("id", KEY_FREE_DISK_TO_DATA_SIZE_RATIO);
                record.setAttribute("name", MSG.view_adminTopology_storageNodes_load_freeDiskToDataSizeRatioName());
                record.setAttribute("hover", MSG.view_adminTopology_storageNodes_load_freeDiskToDataSizeRatioHover());
                record.setAttribute("min", nf.format(aggregate.getMin()));
                record.setAttribute("avg", nf.format(aggregate.getAvg()));
                record.setAttribute("avgFloat", aggregate.getAvg());
                record.setAttribute("max", nf.format(aggregate.getMax()));
                recordsList.add(record);
            }

            // other metrics
            recordsList.add(makeListGridRecord(loadComposite.getActuallyOwns(),
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.