aws / amazon-cloudwatch-agent
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 2,012 units with 21,872 lines of code in units (55.4% of code).
    • 8 very long units (1,048 lines of code)
    • 35 long units (2,207 lines of code)
    • 231 medium size units (6,797 lines of code)
    • 363 small units (5,263 lines of code)
    • 1,375 very small units (6,557 lines of code)
4% | 10% | 31% | 24% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
go4% | 10% | 31% | 24% | 29%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
plugins5% | 15% | 35% | 21% | 21%
cmd50% | 0% | 24% | 11% | 13%
tool7% | 8% | 33% | 21% | 29%
translator0% | 8% | 23% | 28% | 39%
internal0% | 7% | 35% | 31% | 25%
awscsm0% | 0% | 20% | 18% | 61%
cfg0% | 0% | 22% | 48% | 29%
metric0% | 0% | 46% | 6% | 46%
logs0% | 0% | 90% | 0% | 9%
handlers0% | 0% | 82% | 0% | 17%
logger0% | 0% | 0% | 80% | 19%
profiler0% | 0% | 0% | 35% | 64%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func main()
in cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go
173 40 0
func Start()
in plugins/inputs/prometheus_scraper/start.go
157 12 5
func MapOldWindowsConfigToNewConfig()
in tool/processors/migration/windows/windows_migration_core.go
151 44 1
func()
in plugins/inputs/statsd/statsd.go
126 37 1
func main()
in cmd/config-downloader/downloader.go
119 29 0
func runAgent()
in cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go
112 26 3
func()
in plugins/outputs/cloudwatch/cloudwatch.go
108 31 1
func()
in plugins/inputs/logfile/tailersrc.go
102 23 1
func()
in plugins/inputs/logfile/logfile.go
97 23 1
func()
in plugins/inputs/logfile/tail/tail.go
90 27 1
func()
in plugins/outputs/cloudwatchlogs/pusher.go
85 18 1
func()
in plugins/outputs/awscsm/providers/config_provider.go
84 15 1
func GenerateMergedJsonConfigMap()
in translator/cmdutil/translatorutil.go
82 27 1
func()
in plugins/inputs/statsd/statsd.go
74 15 1
func()
in plugins/outputs/awscsm/awscsm.go
74 6 1
func()
in plugins/processors/ec2tagger/ec2tagger.go
73 14 1
func SetMetricPathForOneInput()
in translator/setMetricPath.go
70 19 4
func()
in plugins/outputs/cloudwatch/aggregator.go
70 18 1
func()
in translator/translate/translate.go
68 18 1
func()
in plugins/outputs/cloudwatchlogs/cloudwatchlogs.go
66 19 1