opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

Reuse dictionaries in `ActivityExtensions`, `MetricItemExtensions` and `OtlpLogExporter`

Open paulomorgado opened this issue 1 year ago • 4 comments

Fixes #4943

I have to admit I don't know enough of the usage to know if this is really the best option, but it will reduce the number of allocations and dictionary internal growths.

Changes

Tries to use a single instance of a dictionary for ActivityExtensions, MetricItemExtensions and OtlpLogExporter.

Merge requirement checklist

  • [x] CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • [x] Unit tests added/updated
  • [x] Appropriate CHANGELOG.md files updated for non-trivial changes
  • [x] Changes in public API reviewed (if applicable)

paulomorgado avatar Jun 27 '24 18:06 paulomorgado

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: paulomorgado / name: Paulo Morgado (f989e01ea83c120c51b8ebe054702d9beed972d0)

@paulomorgado Thanks!. Could you check the benchmarks and share the results here : https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/test/Benchmarks/Exporter so we can see before/after!

cijothomas avatar Jun 27 '24 18:06 cijothomas

@cijothomas,

@paulomorgado Thanks!. Could you check the benchmarks and share the results here : https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/test/Benchmarks/Exporter so we can see before/after!

I've collected the benchmark results. They're a lot.

Are you looking for any particular ones?

paulomorgado avatar Jun 28 '24 19:06 paulomorgado

@cijothomas,

@paulomorgado Thanks!. Could you check the benchmarks and share the results here : https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/test/Benchmarks/Exporter so we can see before/after!

I've collected the benchmark results. They're a lot.

Are you looking for any particular ones?

Could you share, so it is easy to tell how much we are improving? (also ensures we don't accidentally regress!) Example : https://github.com/open-telemetry/opentelemetry-dotnet/pull/5457#issuecomment-2008107292

There are few OTLPExporter specific benchmarks: https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/test/Benchmarks/Exporter/OtlpTraceExporterBenchmarks.cs

cijothomas avatar Jun 28 '24 19:06 cijothomas

@paulomorgado - Thank you for your time, appreciate the help. As discussed https://github.com/open-telemetry/opentelemetry-dotnet/pull/5727#discussion_r1661310935, I am closing this PR as the implementation is soon going to change.

vishweshbankwar avatar Jul 01 '24 16:07 vishweshbankwar