2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
25 package org.onap.aai.sparky.sync;
27 import org.onap.aai.sparky.analytics.AbstractStatistics;
28 import org.onap.aai.sparky.sync.config.NetworkStatisticsConfig;
31 * The Class TaskProcessingStats.
33 public class TaskProcessingStats extends AbstractStatistics {
35 private static String TASK_AGE_STATS = "taskAgeStats";
36 private static String TASK_RESPONSE_STATS = "taskResponseStats";
37 private static String RESPONSE_SIZE_IN_BYTES = "taskResponseSizeInBytes";
38 // private static String QUEUE_ITEM_LENGTH = "queueItemLength";
39 private static String TPS = "transactionsPerSecond";
42 * Instantiates a new task processing stats.
44 * @param config the config
46 public TaskProcessingStats(NetworkStatisticsConfig config) {
48 addHistogram(TASK_AGE_STATS, config.getTaskAgeHistogramLabel(),
49 config.getTaskAgeHistogramMaxYAxis(), config.getTaskAgeHistogramNumBins(),
50 config.getTaskAgeHistogramNumDecimalPoints());
52 addHistogram(TASK_RESPONSE_STATS, config.getResponseTimeHistogramLabel(),
53 config.getResponseTimeHistogramMaxYAxis(), config.getResponseTimeHistogramNumBins(),
54 config.getResponseTimeHistogramNumDecimalPoints());
56 addHistogram(RESPONSE_SIZE_IN_BYTES, config.getBytesHistogramLabel(),
57 config.getBytesHistogramMaxYAxis(), config.getBytesHistogramNumBins(),
58 config.getBytesHistogramNumDecimalPoints());
61 * addHistogram(QUEUE_ITEM_LENGTH, config.getQueueLengthHistogramLabel(),
62 * config.getQueueLengthHistogramMaxYAxis(), config.getQueueLengthHistogramNumBins(),
63 * config.getQueueLengthHistogramNumDecimalPoints());
66 addHistogram(TPS, config.getTpsHistogramLabel(), config.getTpsHistogramMaxYAxis(),
67 config.getTpsHistogramNumBins(), config.getTpsHistogramNumDecimalPoints());
72 * public void updateQueueItemLengthHistogram(long value) { updateHistogram(QUEUE_ITEM_LENGTH,
77 * Update task age stats histogram.
79 * @param value the value
81 public void updateTaskAgeStatsHistogram(long value) {
82 updateHistogram(TASK_AGE_STATS, value);
86 * Update task response stats histogram.
88 * @param value the value
90 public void updateTaskResponseStatsHistogram(long value) {
91 updateHistogram(TASK_RESPONSE_STATS, value);
95 * Update response size in bytes histogram.
97 * @param value the value
99 public void updateResponseSizeInBytesHistogram(long value) {
100 updateHistogram(RESPONSE_SIZE_IN_BYTES, value);
104 * Update transactions per second histogram.
106 * @param value the value
108 public void updateTransactionsPerSecondHistogram(long value) {
109 updateHistogram(TPS, value);
113 * Gets the statistics report.
115 * @param verboseEnabled the verbose enabled
116 * @param indentPadding the indent padding
117 * @return the statistics report
119 public String getStatisticsReport(boolean verboseEnabled, String indentPadding) {
121 StringBuilder sb = new StringBuilder();
123 sb.append("\n").append(getHistogramStats(TASK_AGE_STATS, verboseEnabled, indentPadding));
124 // sb.append("\n").append(getHistogramStats(QUEUE_ITEM_LENGTH, verboseEnabled, indentPadding));
125 sb.append("\n").append(getHistogramStats(TASK_RESPONSE_STATS, verboseEnabled, indentPadding));
127 .append(getHistogramStats(RESPONSE_SIZE_IN_BYTES, verboseEnabled, indentPadding));
128 sb.append("\n").append(getHistogramStats(TPS, verboseEnabled, indentPadding));
130 return sb.toString();