-
Notifications
You must be signed in to change notification settings - Fork 44
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
Improve efficiency of ETW metrics exporter #134
base: main
Are you sure you want to change the base?
Improve efficiency of ETW metrics exporter #134
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #134 +/- ##
=======================================
- Coverage 54.1% 53.9% -0.2%
=======================================
Files 42 42
Lines 6279 6149 -130
=======================================
- Hits 3397 3316 -81
+ Misses 2882 2833 -49 ☔ View full report in Codecov by Sentry. |
Comparing the latest |
With a more realistic |
We noticed some Thus, this comment is not blocking as the change is unrelated to this PR, but we propose making those proto types more generic, thus we prevent future confusions regarding tonic usage or not. |
…buffer in emit_export_metric_service_request
I borrowed the |
fn emit_export_metric_service_request( | ||
export_metric_service_request: &ExportMetricsServiceRequest, | ||
) -> MetricResult<()> { | ||
let mut encoding_buffer = Vec::with_capacity(export_metric_service_request.encoded_len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker for this PR but we should be able to reuse the vec
instead of allocating a new one for each export. MetricExporter
struct can hold a vec
as one of its fields and keeping using that vec
for each export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@utpilla good call out. I'll leave that work to a future PR if that's ok with everyone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I make a tweak that's part of the way towards this improvement. Now emit_export_metric_service_request
takes a &mut Vec<u8>
as a parameter to avoid allocating a fresh Vec<u8>
every invocation. Now a new vector is only initialized once per export
.
…ations to avoid repeat allocations as much as possible
|
||
for _i in 0..iters { | ||
runtime.block_on(async { | ||
export(&exporter, &mut resource_metrics).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to micro benchmark just the serialization and export of one data point instead of 20000. It would keep the calculations simple when comparing two benchmark results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is coming from - #134 (comment)
Fixes #104
Design Decisions:
ResourceMetrics
for each metric point and serialize each into an exportable bufferChanges
Please provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes