Skip to content

Commit 57a3de2

Browse files
committed
Add performance section
1 parent 85e732b commit 57a3de2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

docs/design/core/metrics/Design.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,18 @@ MetricRegistry object so that upstream classes can use that information in thei
193193
* `MetricsExecutionInterceptor` will always be the last configured ExecutionInterceptor in the interceptor chain
194194

195195

196+
## Performance
197+
One of the main tenet for metrics is “Enabling default metrics should have minimal impact on the application performance". The following design choices are made to ensure
198+
enabling metrics does not effect performance significantly.
199+
* When collecting metrics, a NoOpRegistry is used if metrics are disabled. All methods in this registry are no-op and return immediately.
200+
This also has the additional benefit of avoid metricsEnabled check at each metric collection point.
201+
* Metric publisher implementations can involve network calls and impact latency if done in blocking way. So all SDK publisher implementation
202+
will process the metrics asynchronously and does not block the actual request.
203+
204+
196205
## Testing
197206

198-
One of the main tenet for metrics is “Enabling default metrics should have minimal impact on the application performance.“
199-
To ensure this, performance tests should be written and a baseline for overhead should be created.
207+
To ensure performance is not impacted due to metrics, tests should be written with various scenarios and a baseline for overhead should be created.
200208
These tests should be run regularly to catch regressions.
201209

202210
### Test Cases

0 commit comments

Comments
 (0)