[Performance] Do not construct `KeyValueIterable` when calling OTel for instruments with empty label/optional label (#37311)

This seems to cut ~5 nanoseconds (10%) off of the `BM_AddCounterWithOTelPlugin` benchmark.

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #37311

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37311 from yijiem:otel-metrics-benchmark 2f8c975cfc
PiperOrigin-RevId: 658915810
pull/37331/head
Yijie Ma 6 months ago committed by Copybara-Service
parent 116bcb46ee
commit ecc1ea512e
Loading…
Cancel
Save