Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Geneva] Optimize metrics exporter serializer #2460

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pentp
Copy link

@pentp pentp commented Jan 10, 2025

Higher-level changes include serializing resource level tags only once for OtlpProtobufMetricExporter.
Most of the changes are just low-level optimizations for efficient buffer access, single-pass string encoding, etc.

BenchmarkDotNet v0.14.0, Windows 10 (10.0.19045.5247/22H2/2022Update)
Intel Core i7-7700K CPU 4.20GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores
.NET SDK 9.0.200-preview.0.24575.35
  [Host]     : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2
  DefaultJob : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2
BASELINE Mean Error StdDev Allocated
SerializeCounterMetricItemWith3Dimensions 162.62 ns 1.355 ns 1.267 ns -
SerializeCounterMetricItemWith4Dimensions 179.49 ns 1.450 ns 1.356 ns -
ExportCounterMetricItemWith3Dimensions 181.36 ns 1.158 ns 1.083 ns -
ExportCounterMetricItemWith4Dimensions 199.94 ns 0.673 ns 0.597 ns -
SerializeHistogramMetricItemWith3Dimensions 275.98 ns 2.971 ns 2.634 ns -
SerializeHistogramMetricItemWith4Dimensions 296.83 ns 3.165 ns 2.961 ns -
ExportHistogramMetricItemWith3Dimensions 299.81 ns 2.303 ns 1.798 ns -
ExportHistogramMetricItemWith4Dimensions 334.96 ns 6.634 ns 6.813 ns -
SerializeCounterMetricItemWith3Dimensions_Otlp 375.91 ns 2.072 ns 1.730 ns 48 B
SerializeCounterMetricItemWith4Dimensions_Otlp 433.05 ns 2.902 ns 2.715 ns 48 B
ExportCounterMetricItemWith3Dimensions_Otlp 378.03 ns 2.738 ns 2.427 ns 48 B
ExportCounterMetricItemWith4Dimensions_Otlp 436.66 ns 2.883 ns 2.697 ns 48 B
SerializeHistogramMetricItemWith3Dimensions_Otlp 468.75 ns 2.976 ns 2.784 ns 48 B
SerializeHistogramMetricItemWith4Dimensions_Otlp 519.62 ns 3.066 ns 2.560 ns 48 B
ExportHistogramMetricItemWith3Dimensions_Otlp 470.72 ns 4.137 ns 3.668 ns 48 B
ExportHistogramMetricItemWith4Dimensions_Otlp 531.59 ns 3.729 ns 3.305 ns 48 B
PR Mean Error StdDev Allocated
SerializeCounterMetricItemWith3Dimensions 134.24 ns 0.803 ns 0.671 ns -
SerializeCounterMetricItemWith4Dimensions 152.22 ns 0.909 ns 0.850 ns -
ExportCounterMetricItemWith3Dimensions 131.44 ns 1.095 ns 0.971 ns -
ExportCounterMetricItemWith4Dimensions 147.23 ns 1.459 ns 1.365 ns -
SerializeHistogramMetricItemWith3Dimensions 191.51 ns 1.098 ns 0.973 ns -
SerializeHistogramMetricItemWith4Dimensions 211.51 ns 1.603 ns 1.421 ns -
ExportHistogramMetricItemWith3Dimensions 190.01 ns 1.047 ns 0.928 ns -
ExportHistogramMetricItemWith4Dimensions 204.39 ns 1.226 ns 1.147 ns -
SerializeCounterMetricItemWith3Dimensions_Otlp 145.69 ns 1.172 ns 1.096 ns -
SerializeCounterMetricItemWith4Dimensions_Otlp 161.80 ns 1.177 ns 1.101 ns -
ExportCounterMetricItemWith3Dimensions_Otlp 146.14 ns 0.812 ns 0.678 ns -
ExportCounterMetricItemWith4Dimensions_Otlp 191.51 ns 0.835 ns 0.697 ns -
SerializeHistogramMetricItemWith3Dimensions_Otlp 188.66 ns 1.410 ns 1.319 ns -
SerializeHistogramMetricItemWith4Dimensions_Otlp 204.14 ns 0.871 ns 0.727 ns -
ExportHistogramMetricItemWith3Dimensions_Otlp 185.20 ns 0.781 ns 0.692 ns -
ExportHistogramMetricItemWith4Dimensions_Otlp 208.30 ns 1.162 ns 1.030 ns -

@pentp pentp requested a review from a team as a code owner January 10, 2025 15:36
@github-actions github-actions bot added the comp:exporter.geneva Things related to OpenTelemetry.Exporter.Geneva label Jan 10, 2025
@github-actions github-actions bot added the perf Performance related label Jan 10, 2025
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:exporter.geneva Things related to OpenTelemetry.Exporter.Geneva perf Performance related Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants