@@ -12,160 +12,160 @@ const (
1212 customerMetricLabel = "customer_metric"
1313 customerMetricLabelValue = "customer metric"
1414 subnetExhaustionStateLabel = "subnet_exhaustion_state"
15- subnetIPExhausted = 1
16- subnetIPNotExhausted = 0
15+ SubnetIPExhausted = 1
16+ SubnetIPNotExhausted = 0
1717)
1818
1919var (
20- ipamAllocatedIPCount = prometheus .NewGaugeVec (
20+ IpamAllocatedIPCount = prometheus .NewGaugeVec (
2121 prometheus.GaugeOpts {
2222 Name : "cx_ipam_pod_allocated_ips" ,
2323 Help : "IPs currently in use by Pods on this CNS Node." ,
2424 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
2525 },
2626 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
2727 )
28- ipamAvailableIPCount = prometheus .NewGaugeVec (
28+ IpamAvailableIPCount = prometheus .NewGaugeVec (
2929 prometheus.GaugeOpts {
3030 Name : "cx_ipam_available_ips" ,
3131 Help : "IPs available on this CNS Node for use by a Pod." ,
3232 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
3333 },
3434 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
3535 )
36- ipamBatchSize = prometheus .NewGaugeVec (
36+ IpamBatchSize = prometheus .NewGaugeVec (
3737 prometheus.GaugeOpts {
3838 Name : "cx_ipam_batch_size" ,
3939 Help : "IPAM IP pool scaling batch size." ,
4040 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
4141 },
4242 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
4343 )
44- ipamCurrentAvailableIPcount = prometheus .NewGaugeVec (
44+ IpamCurrentAvailableIPcount = prometheus .NewGaugeVec (
4545 prometheus.GaugeOpts {
4646 Name : "cx_ipam_current_available_ips" ,
4747 Help : "Current available IP count." ,
4848 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
4949 },
5050 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
5151 )
52- ipamExpectedAvailableIPCount = prometheus .NewGaugeVec (
52+ IpamExpectedAvailableIPCount = prometheus .NewGaugeVec (
5353 prometheus.GaugeOpts {
5454 Name : "cx_ipam_expect_available_ips" ,
5555 Help : "Expected future available IP count assuming the Requested IP count is honored." ,
5656 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
5757 },
5858 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
5959 )
60- ipamMaxIPCount = prometheus .NewGaugeVec (
60+ IpamMaxIPCount = prometheus .NewGaugeVec (
6161 prometheus.GaugeOpts {
6262 Name : "cx_ipam_max_ips" ,
6363 Help : "Maximum Secondary IPs allowed on this Node." ,
6464 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
6565 },
6666 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
6767 )
68- ipamPendingProgramIPCount = prometheus .NewGaugeVec (
68+ IpamPendingProgramIPCount = prometheus .NewGaugeVec (
6969 prometheus.GaugeOpts {
7070 Name : "cx_ipam_pending_programming_ips" ,
7171 Help : "IPs reserved but not yet available (Pending Programming)." ,
7272 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
7373 },
7474 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
7575 )
76- ipamPendingReleaseIPCount = prometheus .NewGaugeVec (
76+ IpamPendingReleaseIPCount = prometheus .NewGaugeVec (
7777 prometheus.GaugeOpts {
7878 Name : "cx_ipam_pending_release_ips" ,
7979 Help : "IPs reserved but not available anymore (Pending Release)." ,
8080 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
8181 },
8282 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
8383 )
84- ipamPrimaryIPCount = prometheus .NewGaugeVec (
84+ IpamPrimaryIPCount = prometheus .NewGaugeVec (
8585 prometheus.GaugeOpts {
8686 Name : "cx_ipam_primary_ips" ,
8787 Help : "NC Primary IP count (reserved from Pod Subnet for DNS and IMDS SNAT)." ,
8888 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
8989 },
9090 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
9191 )
92- ipamRequestedIPConfigCount = prometheus .NewGaugeVec (
92+ IpamRequestedIPConfigCount = prometheus .NewGaugeVec (
9393 prometheus.GaugeOpts {
9494 Name : "cx_ipam_requested_ips" ,
9595 Help : "Secondary Pod Subnet IPs requested by this CNS Node (for Pods)." ,
9696 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
9797 },
9898 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
9999 )
100- ipamSecondaryIPCount = prometheus .NewGaugeVec (
100+ IpamSecondaryIPCount = prometheus .NewGaugeVec (
101101 prometheus.GaugeOpts {
102102 Name : "cx_ipam_secondary_ips" ,
103103 Help : "Node NC Secondary IP count (reserved usable by Pods)." ,
104104 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
105105 },
106106 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
107107 )
108- ipamSubnetExhaustionCount = prometheus .NewCounterVec (
109- prometheus.CounterOpts {
110- Name : "cx_ipam_subnet_exhaustion_state_count_total" ,
111- Help : "Count of the number of times the ipam pool monitor sees subnet exhaustion" ,
112- },
113- []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel , subnetExhaustionStateLabel },
114- )
115- ipamSubnetExhaustionState = prometheus .NewGaugeVec (
108+ IpamTotalIPCount = prometheus .NewGaugeVec (
116109 prometheus.GaugeOpts {
117- Name : "cx_ipam_subnet_exhaustion_state " ,
118- Help : "CNS view of subnet exhaustion state " ,
110+ Name : "cx_ipam_total_ips " ,
111+ Help : "Count of total IP pool size allocated to CNS by DNC. " ,
119112 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
120113 },
121114 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
122115 )
123- ipamTotalIPCount = prometheus .NewGaugeVec (
116+ IpamSubnetExhaustionState = prometheus .NewGaugeVec (
124117 prometheus.GaugeOpts {
125- Name : "cx_ipam_total_ips " ,
126- Help : "Total IPs reserved from the Pod Subnet by this Node. " ,
118+ Name : "cx_ipam_subnet_exhaustion_state " ,
119+ Help : "IPAM view of subnet exhaustion state " ,
127120 ConstLabels : prometheus.Labels {customerMetricLabel : customerMetricLabelValue },
128121 },
129122 []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel },
130123 )
124+ IpamSubnetExhaustionCount = prometheus .NewCounterVec (
125+ prometheus.CounterOpts {
126+ Name : "cx_ipam_subnet_exhaustion_state_count_total" ,
127+ Help : "Count of the number of times the ipam pool monitor sees subnet exhaustion" ,
128+ },
129+ []string {subnetLabel , subnetCIDRLabel , podnetARMIDLabel , subnetExhaustionStateLabel },
130+ )
131131)
132132
133133func init () {
134134 metrics .Registry .MustRegister (
135- ipamAllocatedIPCount ,
136- ipamAvailableIPCount ,
137- ipamBatchSize ,
138- ipamCurrentAvailableIPcount ,
139- ipamExpectedAvailableIPCount ,
140- ipamMaxIPCount ,
141- ipamPendingProgramIPCount ,
142- ipamPendingReleaseIPCount ,
143- ipamPrimaryIPCount ,
144- ipamRequestedIPConfigCount ,
145- ipamSecondaryIPCount ,
146- ipamSubnetExhaustionCount ,
147- ipamSubnetExhaustionState ,
148- ipamTotalIPCount ,
135+ IpamAllocatedIPCount ,
136+ IpamAvailableIPCount ,
137+ IpamBatchSize ,
138+ IpamCurrentAvailableIPcount ,
139+ IpamExpectedAvailableIPCount ,
140+ IpamMaxIPCount ,
141+ IpamPendingProgramIPCount ,
142+ IpamPendingReleaseIPCount ,
143+ IpamPrimaryIPCount ,
144+ IpamSecondaryIPCount ,
145+ IpamRequestedIPConfigCount ,
146+ IpamTotalIPCount ,
147+ IpamSubnetExhaustionState ,
148+ IpamSubnetExhaustionCount ,
149149 )
150150}
151151
152152func observeIPPoolState (state ipPoolState , meta metaState ) {
153153 labels := []string {meta .subnet , meta .subnetCIDR , meta .subnetARMID }
154- ipamAllocatedIPCount .WithLabelValues (labels ... ).Set (float64 (state .allocatedToPods ))
155- ipamAvailableIPCount .WithLabelValues (labels ... ).Set (float64 (state .available ))
156- ipamBatchSize .WithLabelValues (labels ... ).Set (float64 (meta .batch ))
157- ipamCurrentAvailableIPcount .WithLabelValues (labels ... ).Set (float64 (state .currentAvailableIPs ))
158- ipamExpectedAvailableIPCount .WithLabelValues (labels ... ).Set (float64 (state .expectedAvailableIPs ))
159- ipamMaxIPCount .WithLabelValues (labels ... ).Set (float64 (meta .max ))
160- ipamPendingProgramIPCount .WithLabelValues (labels ... ).Set (float64 (state .pendingProgramming ))
161- ipamPendingReleaseIPCount .WithLabelValues (labels ... ).Set (float64 (state .pendingRelease ))
162- ipamPrimaryIPCount .WithLabelValues (labels ... ).Set (float64 (len (meta .primaryIPAddresses )))
163- ipamRequestedIPConfigCount .WithLabelValues (labels ... ).Set (float64 (state .requestedIPs ))
164- ipamSecondaryIPCount .WithLabelValues (labels ... ).Set (float64 (state .secondaryIPs ))
165- ipamTotalIPCount .WithLabelValues (labels ... ).Set (float64 (state .secondaryIPs + int64 (len (meta .primaryIPAddresses ))))
154+ IpamAllocatedIPCount .WithLabelValues (labels ... ).Set (float64 (state .allocatedToPods ))
155+ IpamAvailableIPCount .WithLabelValues (labels ... ).Set (float64 (state .available ))
156+ IpamBatchSize .WithLabelValues (labels ... ).Set (float64 (meta .batch ))
157+ IpamCurrentAvailableIPcount .WithLabelValues (labels ... ).Set (float64 (state .currentAvailableIPs ))
158+ IpamExpectedAvailableIPCount .WithLabelValues (labels ... ).Set (float64 (state .expectedAvailableIPs ))
159+ IpamMaxIPCount .WithLabelValues (labels ... ).Set (float64 (meta .max ))
160+ IpamPendingProgramIPCount .WithLabelValues (labels ... ).Set (float64 (state .pendingProgramming ))
161+ IpamPendingReleaseIPCount .WithLabelValues (labels ... ).Set (float64 (state .pendingRelease ))
162+ IpamPrimaryIPCount .WithLabelValues (labels ... ).Set (float64 (len (meta .primaryIPAddresses )))
163+ IpamRequestedIPConfigCount .WithLabelValues (labels ... ).Set (float64 (state .requestedIPs ))
164+ IpamSecondaryIPCount .WithLabelValues (labels ... ).Set (float64 (state .secondaryIPs ))
165+ IpamTotalIPCount .WithLabelValues (labels ... ).Set (float64 (state .secondaryIPs + int64 (len (meta .primaryIPAddresses ))))
166166 if meta .exhausted {
167- ipamSubnetExhaustionState .WithLabelValues (labels ... ).Set (float64 (subnetIPExhausted ))
167+ IpamSubnetExhaustionState .WithLabelValues (labels ... ).Set (float64 (SubnetIPExhausted ))
168168 } else {
169- ipamSubnetExhaustionState .WithLabelValues (labels ... ).Set (float64 (subnetIPNotExhausted ))
169+ IpamSubnetExhaustionState .WithLabelValues (labels ... ).Set (float64 (SubnetIPNotExhausted ))
170170 }
171171}
0 commit comments