Committed by
Gerrit Code Review
Added Intent PURGED events to the collected Intent Event metrics.
Change-Id: Ibe641b91ffe68e8699d6a21a430ea772a7cb7e7a
Showing
3 changed files
with
33 additions
and
6 deletions
... | @@ -69,6 +69,7 @@ public class IntentMetrics implements IntentMetricsService, | ... | @@ -69,6 +69,7 @@ public class IntentMetrics implements IntentMetricsService, |
69 | private static final String FEATURE_WITHDRAW_REQUESTED_NAME = | 69 | private static final String FEATURE_WITHDRAW_REQUESTED_NAME = |
70 | "WithdrawRequested"; | 70 | "WithdrawRequested"; |
71 | private static final String FEATURE_WITHDRAWN_NAME = "Withdrawn"; | 71 | private static final String FEATURE_WITHDRAWN_NAME = "Withdrawn"; |
72 | + private static final String FEATURE_PURGED_NAME = "Purged"; | ||
72 | // | 73 | // |
73 | // Event metrics: | 74 | // Event metrics: |
74 | // - Intent Submitted API operation | 75 | // - Intent Submitted API operation |
... | @@ -76,12 +77,14 @@ public class IntentMetrics implements IntentMetricsService, | ... | @@ -76,12 +77,14 @@ public class IntentMetrics implements IntentMetricsService, |
76 | // - Intent Failed compilation or installation | 77 | // - Intent Failed compilation or installation |
77 | // - Intent Withdraw Requested API operation | 78 | // - Intent Withdraw Requested API operation |
78 | // - Intent Withdrawn operation completion | 79 | // - Intent Withdrawn operation completion |
80 | + // - Intent Purged operation completion | ||
79 | // | 81 | // |
80 | private EventMetric intentSubmittedEventMetric; | 82 | private EventMetric intentSubmittedEventMetric; |
81 | private EventMetric intentInstalledEventMetric; | 83 | private EventMetric intentInstalledEventMetric; |
82 | private EventMetric intentFailedEventMetric; | 84 | private EventMetric intentFailedEventMetric; |
83 | private EventMetric intentWithdrawRequestedEventMetric; | 85 | private EventMetric intentWithdrawRequestedEventMetric; |
84 | private EventMetric intentWithdrawnEventMetric; | 86 | private EventMetric intentWithdrawnEventMetric; |
87 | + private EventMetric intentPurgedEventMetric; | ||
85 | 88 | ||
86 | @Activate | 89 | @Activate |
87 | protected void activate() { | 90 | protected void activate() { |
... | @@ -135,6 +138,11 @@ public class IntentMetrics implements IntentMetricsService, | ... | @@ -135,6 +138,11 @@ public class IntentMetrics implements IntentMetricsService, |
135 | } | 138 | } |
136 | 139 | ||
137 | @Override | 140 | @Override |
141 | + public EventMetric intentPurgedEventMetric() { | ||
142 | + return intentPurgedEventMetric; | ||
143 | + } | ||
144 | + | ||
145 | + @Override | ||
138 | public void event(IntentEvent event) { | 146 | public void event(IntentEvent event) { |
139 | synchronized (lastEvents) { | 147 | synchronized (lastEvents) { |
140 | switch (event.type()) { | 148 | switch (event.type()) { |
... | @@ -153,6 +161,9 @@ public class IntentMetrics implements IntentMetricsService, | ... | @@ -153,6 +161,9 @@ public class IntentMetrics implements IntentMetricsService, |
153 | case WITHDRAWN: | 161 | case WITHDRAWN: |
154 | intentWithdrawnEventMetric.eventReceived(); | 162 | intentWithdrawnEventMetric.eventReceived(); |
155 | break; | 163 | break; |
164 | + case PURGED: | ||
165 | + intentPurgedEventMetric.eventReceived(); | ||
166 | + break; | ||
156 | default: | 167 | default: |
157 | break; | 168 | break; |
158 | } | 169 | } |
... | @@ -198,12 +209,16 @@ public class IntentMetrics implements IntentMetricsService, | ... | @@ -198,12 +209,16 @@ public class IntentMetrics implements IntentMetricsService, |
198 | intentWithdrawnEventMetric = | 209 | intentWithdrawnEventMetric = |
199 | new EventMetric(metricsService, COMPONENT_NAME, | 210 | new EventMetric(metricsService, COMPONENT_NAME, |
200 | FEATURE_WITHDRAWN_NAME); | 211 | FEATURE_WITHDRAWN_NAME); |
212 | + intentPurgedEventMetric = | ||
213 | + new EventMetric(metricsService, COMPONENT_NAME, | ||
214 | + FEATURE_PURGED_NAME); | ||
201 | 215 | ||
202 | intentSubmittedEventMetric.registerMetrics(); | 216 | intentSubmittedEventMetric.registerMetrics(); |
203 | intentInstalledEventMetric.registerMetrics(); | 217 | intentInstalledEventMetric.registerMetrics(); |
204 | intentFailedEventMetric.registerMetrics(); | 218 | intentFailedEventMetric.registerMetrics(); |
205 | intentWithdrawRequestedEventMetric.registerMetrics(); | 219 | intentWithdrawRequestedEventMetric.registerMetrics(); |
206 | intentWithdrawnEventMetric.registerMetrics(); | 220 | intentWithdrawnEventMetric.registerMetrics(); |
221 | + intentPurgedEventMetric.registerMetrics(); | ||
207 | } | 222 | } |
208 | 223 | ||
209 | /** | 224 | /** |
... | @@ -215,5 +230,6 @@ public class IntentMetrics implements IntentMetricsService, | ... | @@ -215,5 +230,6 @@ public class IntentMetrics implements IntentMetricsService, |
215 | intentFailedEventMetric.removeMetrics(); | 230 | intentFailedEventMetric.removeMetrics(); |
216 | intentWithdrawRequestedEventMetric.removeMetrics(); | 231 | intentWithdrawRequestedEventMetric.removeMetrics(); |
217 | intentWithdrawnEventMetric.removeMetrics(); | 232 | intentWithdrawnEventMetric.removeMetrics(); |
233 | + intentPurgedEventMetric.removeMetrics(); | ||
218 | } | 234 | } |
219 | } | 235 | } | ... | ... |
... | @@ -26,42 +26,49 @@ public interface IntentMetricsService { | ... | @@ -26,42 +26,49 @@ public interface IntentMetricsService { |
26 | /** | 26 | /** |
27 | * Gets the last saved intent events. | 27 | * Gets the last saved intent events. |
28 | * | 28 | * |
29 | - * @return the last saved intent events. | 29 | + * @return the last saved intent events |
30 | */ | 30 | */ |
31 | public List<IntentEvent> getEvents(); | 31 | public List<IntentEvent> getEvents(); |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Gets the Event Metric for the intent INSTALL_REQ events. | 34 | * Gets the Event Metric for the intent INSTALL_REQ events. |
35 | * | 35 | * |
36 | - * @return the Event Metric for the intent INSTALL_REQ events. | 36 | + * @return the Event Metric for the intent INSTALL_REQ events |
37 | */ | 37 | */ |
38 | public EventMetric intentSubmittedEventMetric(); | 38 | public EventMetric intentSubmittedEventMetric(); |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Gets the Event Metric for the intent INSTALLED events. | 41 | * Gets the Event Metric for the intent INSTALLED events. |
42 | * | 42 | * |
43 | - * @return the Event Metric for the intent INSTALLED events. | 43 | + * @return the Event Metric for the intent INSTALLED events |
44 | */ | 44 | */ |
45 | public EventMetric intentInstalledEventMetric(); | 45 | public EventMetric intentInstalledEventMetric(); |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Gets the Event Metric for the intent FAILED events. | 48 | * Gets the Event Metric for the intent FAILED events. |
49 | * | 49 | * |
50 | - * @return the Event Metric for the intent FAILED events. | 50 | + * @return the Event Metric for the intent FAILED events |
51 | */ | 51 | */ |
52 | public EventMetric intentFailedEventMetric(); | 52 | public EventMetric intentFailedEventMetric(); |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Gets the Event Metric for the intent WITHDRAW_REQ events. | 55 | * Gets the Event Metric for the intent WITHDRAW_REQ events. |
56 | * | 56 | * |
57 | - * @return the Event Metric for the intent WITHDRAW_REQ events. | 57 | + * @return the Event Metric for the intent WITHDRAW_REQ events |
58 | */ | 58 | */ |
59 | public EventMetric intentWithdrawRequestedEventMetric(); | 59 | public EventMetric intentWithdrawRequestedEventMetric(); |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Gets the Event Metric for the intent WITHDRAWN events. | 62 | * Gets the Event Metric for the intent WITHDRAWN events. |
63 | * | 63 | * |
64 | - * @return the Event Metric for the intent WITHDRAWN events. | 64 | + * @return the Event Metric for the intent WITHDRAWN events |
65 | */ | 65 | */ |
66 | public EventMetric intentWithdrawnEventMetric(); | 66 | public EventMetric intentWithdrawnEventMetric(); |
67 | + | ||
68 | + /** | ||
69 | + * Gets the Event Metric for the intent PURGED events. | ||
70 | + * | ||
71 | + * @return the Event Metric for the intent PURGED events | ||
72 | + */ | ||
73 | + public EventMetric intentPurgedEventMetric(); | ||
67 | } | 74 | } | ... | ... |
apps/metrics/intent/src/main/java/org/onosproject/metrics/intent/cli/IntentEventsMetricsCommand.java
... | @@ -62,6 +62,8 @@ public class IntentEventsMetricsCommand extends AbstractShellCommand { | ... | @@ -62,6 +62,8 @@ public class IntentEventsMetricsCommand extends AbstractShellCommand { |
62 | service.intentWithdrawRequestedEventMetric()); | 62 | service.intentWithdrawRequestedEventMetric()); |
63 | result = json(mapper, result, "intentWithdrawn", | 63 | result = json(mapper, result, "intentWithdrawn", |
64 | service.intentWithdrawnEventMetric()); | 64 | service.intentWithdrawnEventMetric()); |
65 | + result = json(mapper, result, "intentPurged", | ||
66 | + service.intentPurgedEventMetric()); | ||
65 | print("%s", result); | 67 | print("%s", result); |
66 | } else { | 68 | } else { |
67 | printEventMetric("Submitted", | 69 | printEventMetric("Submitted", |
... | @@ -74,6 +76,8 @@ public class IntentEventsMetricsCommand extends AbstractShellCommand { | ... | @@ -74,6 +76,8 @@ public class IntentEventsMetricsCommand extends AbstractShellCommand { |
74 | service.intentWithdrawRequestedEventMetric()); | 76 | service.intentWithdrawRequestedEventMetric()); |
75 | printEventMetric("Withdrawn", | 77 | printEventMetric("Withdrawn", |
76 | service.intentWithdrawnEventMetric()); | 78 | service.intentWithdrawnEventMetric()); |
79 | + printEventMetric("Purged", | ||
80 | + service.intentPurgedEventMetric()); | ||
77 | } | 81 | } |
78 | } | 82 | } |
79 | 83 | ... | ... |
-
Please register or login to post a comment