blob: deb4c277936b0ec80064dede0487552eefe2e47a [file] [log] [blame]
amit.ghosh6ab2a982022-09-15 21:04:53 +02001/*
Joey Armstrong9cdee9f2024-01-03 04:56:14 -05002* Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors
amit.ghosh6ab2a982022-09-15 21:04:53 +02003
Joey Armstrong7f8436c2023-07-09 20:23:27 -04004* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
amit.ghosh6ab2a982022-09-15 21:04:53 +02007
Joey Armstrong7f8436c2023-07-09 20:23:27 -04008* http://www.apache.org/licenses/LICENSE-2.0
amit.ghosh6ab2a982022-09-15 21:04:53 +02009
Joey Armstrong7f8436c2023-07-09 20:23:27 -040010* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
amit.ghosh6ab2a982022-09-15 21:04:53 +020015 */
16package stats
17
18type DeviceCounter string
19type NonDeviceCounter string
20
21type NonDeviceDuration string
22type DeviceDuration string
23
24// The unit for all the time based metrics are in milli seconds
25
26const (
27 // OLT Device stats
28 //-----------------
29 // Number of ONU Discovery messages received by the OLT adapter
30 NumDiscoveriesReceived DeviceCounter = "discoveries_received_total"
31 // Number of ONUs successfully activated by the OLT adapter
32 NumOnusActivated DeviceCounter = "activated_onus_total"
33
34 // ONT Device stats
35 //-----------------
36 // Number of times transmission retries for OMCI messages were done for a specific ONU
37 OmciCCTxRetries DeviceCounter = "omci_cc_tx_retries_total"
38 // Number of times transmission timeouts for OMCI messages happened for a specific ONU
39 OmciCCTxTimeouts DeviceCounter = "omci_cc_tx_timeous_total"
40
41 // Other not device specific stats
42 //--------------------------------
43 // Number of times writing to the message bus failed, could be collected by adapters as well as vCore
44 NumErrorsWritingToBus NonDeviceCounter = "bus_write_errors_total"
45 // Number of times rpc calls to the vCore resulted in errors at the adapters
46 NumCoreRpcErrors NonDeviceCounter = "core_rpc_errors_total"
47 // Number of times rpc calls to the adapters resulted in errors at the vCore
48 NumAdapterRpcErrors NonDeviceCounter = "adapter_rpc_errors_total"
49
50 // OLT Device durations
51 //---------------------
52 // Time taken at the OLT adapter to process successfully an ONU Discovery message received
53 OnuDiscoveryProcTime DeviceDuration = "onu_discovery_proc_time"
54 // Time taken at the OLT adapter to successfully activate an ONU
55 OnuDiscToActivateTime DeviceDuration = "onu_discovery_to_activate_time"
56 // Time taken at the OLT adapter from the time the ONU Discovery was received to the first flow being pushed for the ONU
57 OnuDiscToFlowsPushedTime DeviceDuration = "onu_disc_to_flows_pushed_time"
58
59 // ONU Device durations
60 //---------------------
61
62 // Other not device specific durations
63 //------------------------------------
64 // Time taken to write an entry to the database, could be collected by all the three users of the database
65 DBWriteTime NonDeviceDuration = "db_write_time"
66 // Time taken to read an entry from the database, could be collected by all the three users of the database
67 DBReadTime NonDeviceDuration = "db_read_time"
68)
69
70func (s DeviceCounter) String() string {
71 switch s {
72 case NumDiscoveriesReceived:
73 return "discoveries_received_total"
74 case NumOnusActivated:
75 return "activated_onus_total"
76 case OmciCCTxRetries:
77 return "omci_cc_tx_retries_total"
78 case OmciCCTxTimeouts:
79 return "omci_cc_tx_timeous_total"
80 }
81 return "unknown"
82}
83
84func (s NonDeviceCounter) String() string {
85 switch s {
86 case NumErrorsWritingToBus:
87 return "bus_write_errors_total"
88 case NumCoreRpcErrors:
89 return "core_rpc_errors_total"
90 case NumAdapterRpcErrors:
91 return "adapter_rpc_errors_total"
92 }
93 return "unknown"
94}
95
96func (s NonDeviceDuration) String() string {
97 switch s {
98 case DBWriteTime:
99 return "db_write_time"
100 case DBReadTime:
101 return "db_read_time"
102 }
103 return "unknown"
104}
105
106func (s DeviceDuration) String() string {
107 switch s {
108 case OnuDiscoveryProcTime:
109 return "onu_discovery_proc_time"
110 case OnuDiscToActivateTime:
111 return "onu_discovery_to_activate_time"
112 case OnuDiscToFlowsPushedTime:
113 return "onu_disc_to_flows_pushed_time"
114 }
115 return "unknown"
116}