aws-samples / serverless-observability-workshop
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 42 units with 353 lines of code in units (3.6% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 4 medium size units (136 lines of code)
    • 10 small units (128 lines of code)
    • 28 very small units (89 lines of code)
0% | 0% | 38% | 36% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js0% | 0% | 45% | 27% | 27%
py0% | 0% | 0% | 84% | 15%
ts0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
code/log-processing0% | 0% | 20% | 48% | 30%
code/backend0% | 0% | 48% | 15% | 35%
code/sample-app-tracing0% | 0% | 61% | 20% | 18%
code/sample-app0% | 0% | 72% | 23% | 4%
code/cloudwatch-cdk0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
yield makeMetric()
in code/log-processing/src/handlers/index.js
34 8 6
Dimensions: buildDimensions()
in code/sample-app-tracing/src/lib/logging/logger.js
34 9 2
Dimensions: buildDimensions()
in code/sample-app/src/lib/logging/logger.js
34 9 2
Dimensions: buildDimensions()
in code/backend/src/lib/logging/logger.js
34 9 2
retries: parseInt()
in code/log-processing/src/handlers/index.js
16 5 1
minTimeout: parseFloat()
in code/log-processing/src/handlers/index.js
15 4 1
Dimensions: buildDimensions()
in code/log-processing/src/lib/logging/logger.js
14 2 2
maxTimeout: parseFloat()
in code/log-processing/src/handlers/index.js
14 3 1
constructor()
in code/cloudwatch-cdk/lib/cloudwatch-cdk-stack.ts
13 1 3
yield makeMetric()
in code/log-processing/src/handlers/index.js
12 3 6
yield makeMetric()
in code/log-processing/src/handlers/index.js
11 3 6
def index()
in code/sample-app-tracing/locust-script.py
11 1 1
def index()
in code/sample-app/locust-script.py
11 1 1
def index()
in code/backend/locust-script.py
11 1 1
yield makeMetric()
in code/log-processing/src/handlers/index.js
10 3 6
yield makeMetric()
in code/log-processing/src/handlers/index.js
10 4 6
function makeMetric()
in code/log-processing/src/handlers/index.js
10 1 6
await retry()
in code/log-processing/src/handlers/index.js
9 4 1
await publishSns()
in code/sample-app-tracing/src/handlers/put-item.js
8 1 1
await publishSns()
in code/backend/src/handlers/put-item.js
8 1 2