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

[Exporter] Group spans by resource and instrumentation scope in OTLP export requests #2335

Merged
merged 12 commits into from
Sep 28, 2023

Conversation

mbrobbel
Copy link
Contributor

This PR changes the implementation of OtlpRecordableUtils::PopulateRequest to group spans by their resource and instrumentation scope.

Instead of duplicating the resource and instrumentation scope for every span this now collects spans with the same resources and instrumentation scopes, reducing the size of the resulting proto::collector::trace::v1::ExportTraceServiceRequest.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@mbrobbel mbrobbel requested a review from a team September 27, 2023 08:48
@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #2335 (0835a0e) into main (a45081a) will increase coverage by 0.02%.
Report is 1 commits behind head on main.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2335      +/-   ##
==========================================
+ Coverage   87.43%   87.45%   +0.02%     
==========================================
  Files         199      199              
  Lines        5997     5997              
==========================================
+ Hits         5243     5244       +1     
+ Misses        754      753       -1     

see 1 file with indirect coverage changes

@mbrobbel mbrobbel marked this pull request as draft September 27, 2023 09:41
@mbrobbel mbrobbel marked this pull request as ready for review September 27, 2023 14:06
Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nicely done. We should do similar optimization for logs too. Will raise a issue for that, so someone can pick it.

{
*scope_spans->add_spans() = std::move(input_span->span());
}
}
Copy link
Member

@lalitb lalitb Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - perhaps we can remove OtlpRecordable::ProtoResource(), OtlpRecordable::GetProtoInstrumentationScope() and OtlpRecordable::GetInstrumentationLibrarySchemaURL() methods now that they are not used to populate request object.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and very clean fix.

@marcalff marcalff changed the title Group spans by resource and instrumentation scope in OTLP export requests [Exporter] Group spans by resource and instrumentation scope in OTLP export requests Sep 28, 2023
@marcalff marcalff merged commit 5e96b80 into open-telemetry:main Sep 28, 2023
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants