kubernetes / node-problem-detector
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 256 units with 4,032 lines of code in units (70.7% of code).
    • 4 very long units (481 lines of code)
    • 7 long units (452 lines of code)
    • 51 medium size units (1,480 lines of code)
    • 58 small units (864 lines of code)
    • 136 very small units (755 lines of code)
11% | 11% | 36% | 21% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go11% | 11% | 36% | 21% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pkg/systemstatsmonitor25% | 31% | 31% | 6% | 4%
pkg/custompluginmonitor44% | 0% | 36% | 5% | 13%
pkg/util0% | 9% | 36% | 25% | 27%
pkg/systemlogmonitor0% | 9% | 36% | 26% | 27%
pkg/healthchecker0% | 0% | 44% | 40% | 14%
pkg/exporters0% | 0% | 23% | 42% | 34%
cmd/nodeproblemdetector0% | 0% | 62% | 17% | 20%
cmd/options0% | 0% | 59% | 31% | 9%
cmd/healthchecker0% | 0% | 60% | 21% | 18%
pkg/problemdetector0% | 0% | 67% | 20% | 11%
pkg/problemmetrics0% | 0% | 40% | 31% | 28%
cmd/logcounter0% | 0% | 58% | 26% | 14%
pkg/logcounter0% | 0% | 52% | 47% | 0%
pkg/problemdaemon0% | 0% | 0% | 50% | 50%
pkg/version0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func NewNetCollectorOrDie()
in pkg/systemstatsmonitor/net_collector.go
165 17 1
func NewCPUCollectorOrDie()
in pkg/systemstatsmonitor/cpu_collector.go
106 11 1
func()
in pkg/custompluginmonitor/custom_plugin_monitor.go
105 28 1
func()
in pkg/custompluginmonitor/plugin/plugin.go
105 20 1
func NewDiskCollectorOrDie()
in pkg/systemstatsmonitor/disk_collector.go
95 9 1
func()
in pkg/systemstatsmonitor/net_collector.go
76 19 1
func main()
in pkg/util/nethealth/nethealth.go
61 12 0
func()
in pkg/systemstatsmonitor/disk_collector.go
59 15 1
func NewMemoryCollectorOrDie()
in pkg/systemstatsmonitor/memory_collector.go
55 6 1
func()
in pkg/systemlogmonitor/log_monitor.go
55 11 1
func()
in pkg/systemstatsmonitor/cpu_collector_linux.go
51 13 1
func()
in pkg/systemstatsmonitor/disk_collector.go
45 10 1
func NewSystemStatsMonitorOrDie()
in pkg/systemstatsmonitor/system_stats_monitor.go
45 12 1
func getJournal()
in pkg/systemlogmonitor/logwatchers/journald/log_watcher.go
41 9 2
func()
in pkg/custompluginmonitor/types/config.go
40 12 1
func()
in cmd/options/options.go
39 3 1
func()
in pkg/systemstatsmonitor/memory_collector_linux.go
38 9 1
func()
in pkg/systemstatsmonitor/osfeature_collector.go
38 10 1
func()
in pkg/systemlogmonitor/logwatchers/filelog/log_watcher.go
38 8 1
func()
in pkg/systemlogmonitor/logwatchers/journald/log_watcher.go
37 8 1