Skip to content

Package: SubscribeMetric

SubscribeMetric

nameinstructionbranchcomplexitylinemethod
SubscribeMetric()
M: 53 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getAllowedMessages()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getInstance()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getNotAllowedMessages()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getTime()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.broker.core.plugin.metric;
14:
15: import com.codahale.metrics.Counter;
16: import com.codahale.metrics.Timer;
17: import org.eclipse.kapua.commons.metric.MetricServiceFactory;
18: import org.eclipse.kapua.commons.metric.MetricsService;
19:
20: public class SubscribeMetric {
21:
22: private static final SubscribeMetric SUBSCRIBE_METRIC = new SubscribeMetric();
23:
24: private Counter allowedMessages;
25: private Counter notAllowedMessages;
26: private Timer time;
27:
28: public static SubscribeMetric getInstance() {
29: return SUBSCRIBE_METRIC;
30: }
31:
32: private SubscribeMetric() {
33: MetricsService metricsService = MetricServiceFactory.getInstance();
34: allowedMessages = metricsService.getCounter(SecurityMetrics.METRIC_MODULE_NAME, SecurityMetrics.METRIC_COMPONENT_SUBSCRIBE, SecurityMetrics.METRIC_ALLOWED, SecurityMetrics.METRIC_COUNT);
35: notAllowedMessages = metricsService.getCounter(SecurityMetrics.METRIC_MODULE_NAME, SecurityMetrics.METRIC_COMPONENT_SUBSCRIBE, SecurityMetrics.METRIC_NOT_ALLOWED, SecurityMetrics.METRIC_COUNT);
36: time = metricsService.getTimer(SecurityMetrics.METRIC_MODULE_NAME, SecurityMetrics.METRIC_COMPONENT_SUBSCRIBE, SecurityMetrics.METRIC_TIME, SecurityMetrics.METRIC_S);
37: }
38:
39: public Counter getAllowedMessages() {
40: return allowedMessages;
41: }
42:
43: public Counter getNotAllowedMessages() {
44: return notAllowedMessages;
45: }
46:
47: public Timer getTime() {
48: return time;
49: }
50:
51: }