mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
The gRPC service handlers for all four signal types allocate the
top-level ExportXxxServiceRequest with bare new(), bypassing the
sync.Pool when pdata.useProtoPooling is enabled. This means objects
returned to the pool via Delete are never retrieved, so the pool
accumulates unreused objects.
Replace new() with the pool-aware New*() constructors so the top-level
request struct participates in the pool lifecycle.
benchstat (20 runs, pdata.useProtoPooling=true, 10k logs/request):
```
│ old (new()) │ new (New*()) │
│ sec/op │ sec/op vs base │
GRPCLogsSequentialPooling-12 3.858m ± 2% 3.811m ± 1% ~ (p=0.165 n=20)
│ B/op │ B/op vs base │
GRPCLogsSequentialPooling-12 3.551Mi ± 2% 3.523Mi ± 1% ~ (p=0.445 n=20)
│ allocs/op │ allocs/op vs base│
GRPCLogsSequentialPooling-12 75.46k ± 0% 75.46k ± 0% ~ (p=0.867 n=20)
```
No measurable perf difference (1 alloc out of 75k), but this is a
correctness fix for the pool lifecycle.
<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #
<!--Describe what testing was performed and which tests were added.-->
#### Testing
<!--Describe the documentation added.-->
#### Documentation
<!--Please delete paragraphs that you did not use before submitting.-->
---------
Co-authored-by: Pablo Baeyens <[email protected]>