kubernetes / kube-state-metrics
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 328 units with 7,174 lines of code in units (80.5% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 12 medium complex units (1,436 lines of code)
    • 18 simple units (1,573 lines of code)
    • 298 very simple units (4,165 lines of code)
0% | 0% | 20% | 21% | 58%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
go0% | 0% | 20% | 21% | 58%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
internal/store0% | 0% | 21% | 21% | 56%
pkg/metricshandler0% | 0% | 44% | 26% | 28%
pkg/options0% | 0% | 24% | 0% | 75%
pkg/app0% | 0% | 0% | 75% | 24%
pkg/sharding0% | 0% | 0% | 41% | 58%
pkg/allow0% | 0% | 0% | 66% | 33%
pkg/metric0% | 0% | 0% | 34% | 65%
pkg/metrics_store0% | 0% | 0% | 20% | 79%
pkg/allowdenylist0% | 0% | 0% | 0% | 100%
pkg/metric_generator0% | 0% | 0% | 0% | 100%
pkg/builder0% | 0% | 0% | 0% | 100%
pkg/watch0% | 0% | 0% | 0% | 100%
pkg/optin0% | 0% | 0% | 0% | 100%
pkg/util0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
pkg/version0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func vpaMetricFamilies()
in internal/store/verticalpodautoscaler.go
195 23 2
func jobMetricFamilies()
in internal/store/job.go
312 22 2
func()
in pkg/options/types.go
55 18 1
func hpaMetricFamilies()
in internal/store/horizontalpodautoscaler.go
212 16 2
func persistentVolumeMetricFamilies()
in internal/store/persistentvolume.go
207 16 2
func()
in pkg/metricshandler/metrics_handler.go
71 14 1
78 11 0
78 11 0
57 11 0
57 11 0
57 11 0
57 11 0
func RunKubeStateMetrics()
in pkg/app/server.go
118 10 3
func ingressMetricFamilies()
in internal/store/ingress.go
133 9 2
func cronJobMetricFamilies()
in internal/store/cronjob.go
221 9 2
func detectStatefulSet()
in pkg/metricshandler/metrics_handler.go
18 8 3
func()
in pkg/allow/allow_labels.go
26 8 1
func deploymentMetricFamilies()
in internal/store/deployment.go
257 8 2
func()
in pkg/sharding/listwatch.go
28 7 1
func createKubeClient()
in pkg/app/server.go
34 7 3