The business logic to instrumentation (B2I) ratio measures instrumentation cost by dividing lines of code after instrumentation by lines of code before it. A ratio of 1 represents no added code; higher values indicate more instrumentation code. section 2.2
B2I = LOC_AFTER_INSTRUMENTATION/LOC_BEFORE_INSTRUMENTATION
Calculate the ratio as LOC_AFTER_INSTRUMENTATION divided by LOC_BEFORE_INSTRUMENTATION. section 2.2
Comparing signal types
A service with 3,800 original lines and 400 added instrumentation lines has a B2I ratio of 1.105. In a 24-line example, logs produce a ratio of 1.33, metrics 2, and traces 2.79 when their instrumentation is isolated. section 2.2 section 2.4.3 section 2.3.3 section 2.5.3
Use the ratio as a practical comparison signal, with these qualifications:
- Choose consistently whether telemetry libraries such as an OpenTelemetry SDK count; excluding dependencies and focusing on application code is a pragmatic option. section 2.2
- Use it for regression validation rather than as an absolute measure of instrumentation quality or over-instrumentation. section 2.2
- Interpret higher ratios alongside maintainability, runtime overhead, sampling, cardinality, and telemetry collection costs. section 2.4.3 section 2.5.3
