Examples of CallTimeData


Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

    }

    private CallTimeData createCallTimeData(MeasurementScheduleRequest schedule, Map<String, Stat> stats,
        Date lastResetTime, Date collectionTime) throws Exception {

        CallTimeData previousRawCallTimeData = this.previousRawCallTimeDatas.get(schedule.getScheduleId());
        CallTimeData rawCallTimeData = new CallTimeData(schedule);
        this.previousRawCallTimeDatas.put(schedule.getScheduleId(), rawCallTimeData);

        CallTimeData callTimeData = new CallTimeData(schedule);
        for (String methodName : stats.keySet()) {
            Stat timeStatistic = stats.get(methodName);

            long minTime = timeStatistic.min;
            long maxTime = timeStatistic.max;
            long totalTime = timeStatistic.total;
            long count = timeStatistic.count;

            try {
                rawCallTimeData.addAggregatedCallData(methodName, lastResetTime, collectionTime, minTime, maxTime,
                    totalTime, count);
            } catch (IllegalArgumentException iae) {
                // if any issue with the data, log them and continue processing the rest of the report
                log.error(iae);
                continue;
            }

            // Now compute the adjusted data, which is what we will report back to the server.
            CallTimeDataValue previousValue = (previousRawCallTimeData != null) ? previousRawCallTimeData.getValues()
                .get(methodName) : null;
            boolean supercedesPrevious = ((previousValue != null) && (previousValue.getBeginTime() == lastResetTime
                .getTime()));
            Date beginTime = lastResetTime;
            if (supercedesPrevious) {
                // The data for this method hasn't been reset since the last time we collected it.
                long countSincePrevious = count - previousValue.getCount();
                if (countSincePrevious > 0) {
                    // There have been new calls since the last time we collected data
                    // for this method. Adjust the time span to begin at the end of the
                    // time span from the previous collection.
                    beginTime = new Date(previousValue.getEndTime());

                    // Adjust the total and count to reflect the adjusted time span;
                    // do so by subtracting the previous values from the current values.
                    // NOTE: It isn't possible to figure out the minimum and maximum for
                    // the adjusted time span, so just leave them be. If they happen
                    // to have changed since the previous collection, they will be
                    // accurate; otherwise they will not.
                    count = countSincePrevious;
                    totalTime = totalTime - (long) previousValue.getTotal();
                }
                // else, the count hasn't changed, so don't bother adjusting the data;
                // when the server sees the data has the same begin time as
                // previously persisted data, it will replace the previous data with the
                // updated data (which will basically have a later end time)
            }

            callTimeData.addAggregatedCallData(methodName, beginTime, collectionTime, minTime, maxTime, totalTime,
                count);
        }

        return callTimeData;
    }
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

            MeasurementScheduleRequest request = iterator.next();
            if (request.getName().equals(RESPONSE_TIME_METRIC)) {
                iterator.remove();
                if (this.responseTimeLogParser != null) {
                    try {
                        CallTimeData callTimeData = new CallTimeData(request);
                        this.responseTimeLogParser.parseLog(callTimeData);
                        report.addData(callTimeData);
                    } catch (Exception e) {
                        getLog().error("Failed to retrieve call-time metric '" + RESPONSE_TIME_METRIC + "' for "
                                + context.getResourceType() + " Resource with key [" + context.getResourceKey() + "].",
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

        }
    }

    private CallTimeData
        createCalltimeData(MeasurementScheduleRequest request, Map<String, Set<JobSummary>> pendingJobs) {
        CallTimeData ret = new CallTimeData(request);

        String metricName = request.getName();

        for (Map.Entry<String, Set<JobSummary>> e : pendingJobs.entrySet()) {
            String jobName = e.getKey();
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

            String metricName = schedule.getName();
            try {
                if (metricName.equals(METRIC_RESPONSE_TIME)) {
                    if (this.logParser != null) {
                        try {
                            CallTimeData callTimeData = new CallTimeData(schedule);
                            this.logParser.parseLog(callTimeData);
                            report.addData(callTimeData);
                        } catch (Exception e) {
                            log.error("Failed to retrieve HTTP call-time data.", e);
                        }
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

    public void testMeasurementReport() {
        MeasurementReport report = new MeasurementReport();
        report.setCollectionTime(1111);

        CallTimeData callTimeData = new CallTimeData(new MeasurementScheduleRequest(1, "1", 1, true, DataType.CALLTIME));
        callTimeData.addCallData("dest1", new Date(1111), 1);
        callTimeData.addCallData("dest1", new Date(1112), 2);

        report.addData(callTimeData);

        report.addData(new MeasurementDataNumeric(2, new MeasurementScheduleRequest(2, "2", 2, true,
            DataType.MEASUREMENT), new Double(2.2)));
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

        assertNotNull("why don't we have a calltime schedule?", calltimeSchedule);

        MeasurementScheduleRequest msr = new MeasurementScheduleRequest(calltimeSchedule);

        Set<CallTimeData> dataset = new HashSet<CallTimeData>();
        CallTimeData data = new CallTimeData(msr);

        for (int i = 0; i < count; i++) {
            for (int j = 0; j < count; j++) {
                data.addCallData("DataPurgeJobTestCalltimeData" + j, new Date(timestamp), 777);
            }
        }

        dataset.add(data);
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

            try {
                if (metricName.equals("methodInvocationTime")) {
                    // Convert the method stats CompositeValues into nice strongly typed objects.
                    InvocationStats invocationStats = getInvocationStats(managedComponent);
                    if (!invocationStats.methodStats.isEmpty()) {
                        CallTimeData callTimeData = createCallTimeData(request, invocationStats);
                        report.addData(callTimeData);
                        resetInvocationStats(managedComponent);
                    }
                } else {
                    remainingRequests.add(request);
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

        return invocationStats;
    }

    private CallTimeData createCallTimeData(MeasurementScheduleRequest schedule, InvocationStats invocationStats)
        throws Exception {
        CallTimeData callTimeData = new CallTimeData(schedule);
        Date beginDate = new Date(invocationStats.beginTime);
        Date endDate = new Date(invocationStats.endTime);
        for (MethodStats methodStats : invocationStats.methodStats) {
            try {
                callTimeData.addAggregatedCallData(methodStats.name, beginDate, endDate, methodStats.minTime,
                    methodStats.maxTime, methodStats.totalTime, methodStats.count);
            } catch (IllegalArgumentException iae) {
                // if any issue with the data, log them and continue processing the rest of the report
                log.error(iae);
            }
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

        for (MeasurementScheduleRequest schedule : schedules) {
            String metricName = schedule.getName();
            if (metricName.equals(RESPONSE_TIME_METRIC)) {
                if (this.logParser != null) {
                    try {
                        CallTimeData callTimeData = new CallTimeData(schedule);
                        this.logParser.parseLog(callTimeData);
                        report.addData(callTimeData);
                    } catch (Exception e) {
                        LOG.error("Failed to retrieve HTTP call-time data.", e);
                    }
View Full Code Here

Examples of org.rhq.core.domain.measurement.calltime.CallTimeData

                 }
             } else if (metricName.equals(RESPONSE_TIME_METRIC)) {
                /* a special handling for ResponseTime */
                if (this.logParser != null) {
                    try {
                        CallTimeData callTimeData = new CallTimeData(schedule);
                        this.logParser.parseLog(callTimeData);
                        report.addData(callTimeData);
                    } catch (Exception e) {
                        LOG.error("Failed to retrieve HTTP call-time data.", e);
                    }
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.