Skip to content

Conversation

bogdandrutu
Copy link
Member

@bogdandrutu bogdandrutu commented Aug 10, 2025

And if anyone is interested why, it is mostly that gogoproto has some missing optimizations that I applied. Here are some examples:

  1. For the oneof (see https://github.com/open-telemetry/opentelemetry-collector/blob/main/pdata/internal/data/protogen/metrics/v1/metrics.pb.go#L2307) they don't call the MarshalToSized which leads to 2 extra Size() calls.
  2. Another big one is about how they marshal packed (repeated (slice) scalars that are represented as variants (not fixed) ), see https://github.com/open-telemetry/opentelemetry-collector/blob/main/pdata/internal/data/protogen/metrics/v1/metrics.pb.go#L3114. Here they can simply start from last element and call encodeVariant.
goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/collector/pdata/pmetric
cpu: Apple M2 Max
BenchmarkMetricsProtoMarshal-12                   235209              5124 ns/op            6144 B/op          1 allocs/op
BenchmarkMetricsProtoMarshalNew-12                320055              3529 ns/op            6144 B/op          1 allocs/op
BenchmarkMetricsProtoMarshalGoProtobuf-12          37998             31246 ns/op            6144 B/op          1 allocs/op
BenchmarkMetricsProtoUnmarshal-12                  66105             18018 ns/op           36217 B/op        908 allocs/op
BenchmarkMetricsProtoUnmarshalNew-12               66057             18026 ns/op           36217 B/op        908 allocs/op
BenchmarkMetricsProtoUnmarshalGoProtobuf-12        26983             44656 ns/op           50777 B/op        911 allocs/op

@bogdandrutu bogdandrutu changed the title Benchmark Show benchmarks for metrics between gogo/handwritten/google_protobuf Aug 11, 2025
Copy link

codecov bot commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 19.51220% with 2937 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.86%. Comparing base (10fd06d) to head (e423f09).
⚠️ Report is 67 commits behind head on main.

Files with missing lines Patch % Lines
pdata/internal/generated_wrapper_profile.go 5.67% 182 Missing and 1 partial ⚠️
pdata/internal/generated_wrapper_span.go 5.88% 175 Missing and 1 partial ⚠️
...generated_wrapper_exponentialhistogramdatapoint.go 6.62% 154 Missing and 1 partial ⚠️
...a/internal/generated_wrapper_histogramdatapoint.go 7.59% 145 Missing and 1 partial ⚠️
pdata/internal/generated_wrapper_logrecord.go 8.14% 123 Missing and 1 partial ⚠️
pdata/internal/generated_wrapper_mapping.go 9.75% 110 Missing and 1 partial ⚠️
pdata/internal/generated_wrapper_sample.go 10.81% 98 Missing and 1 partial ⚠️
...a/internal/generated_wrapper_profilesdictionary.go 12.00% 87 Missing and 1 partial ⚠️
...ata/internal/generated_wrapper_summarydatapoint.go 12.50% 83 Missing and 1 partial ⚠️
pdata/internal/proto/unmarshal.go 16.66% 71 Missing and 4 partials ⚠️
... and 45 more

❌ Your patch check has failed because the patch coverage (19.51%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (85.86%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (10fd06d) and HEAD (e423f09). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (10fd06d) HEAD (e423f09)
2 1
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13602      +/-   ##
==========================================
- Coverage   92.78%   85.86%   -6.93%     
==========================================
  Files         630      631       +1     
  Lines       35515    39018    +3503     
==========================================
+ Hits        32953    33502     +549     
- Misses       2018     4911    +2893     
- Partials      544      605      +61     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

github-merge-queue bot pushed a commit that referenced this pull request Aug 14, 2025
Benchmark results are in
#13602

Signed-off-by: Bogdan Drutu <[email protected]>
Copy link
Contributor

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

@github-actions github-actions bot added the Stale label Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants