203bfaccd4c139222ac3336761cfd3e4ed9b64a5
[ccsdk/oran.git] /
1 /*-
2  * ========================LICENSE_START=================================
3  * ONAP : ccsdk oran
4  * ======================================================================
5  * Copyright (C) 2022 Nordix Foundation. All rights reserved.
6  * ======================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ========================LICENSE_END===================================
19  */
20
21 package org.onap.ccsdk.oran.a1policymanagementservice.configuration;
22
23 import io.micrometer.core.instrument.MeterRegistry;
24
25 import org.onap.ccsdk.oran.a1policymanagementservice.repository.Policies;
26 import org.onap.ccsdk.oran.a1policymanagementservice.repository.PolicyTypes;
27 import org.onap.ccsdk.oran.a1policymanagementservice.repository.Rics;
28 import org.springframework.beans.factory.annotation.Autowired;
29 import org.springframework.stereotype.Component;
30
31 /**
32  * The aim is to collect statistical values from the A1 Policy Management
33  * Service.
34  * The counters are being updated every minute.
35  */
36 @Component
37 public class Meters {
38
39     @Autowired
40     public Meters(Rics rics, PolicyTypes policyTypes, Policies policies, MeterRegistry meterRegistry) {
41         meterRegistry.gauge("total_ric_count", rics, Rics::size);
42         meterRegistry.gauge("total_policy_type_count", policyTypes, PolicyTypes::size);
43         meterRegistry.gauge("total_policy_count", policies, Policies::size);
44     }
45 }