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

Could we avoid attributes merge in HttpServerMetrics.onEnd? #11887

Open
wgy035 opened this issue Jul 24, 2024 · 2 comments · May be fixed by #11959
Open

Could we avoid attributes merge in HttpServerMetrics.onEnd? #11887

wgy035 opened this issue Jul 24, 2024 · 2 comments · May be fixed by #11959
Labels
enhancement New feature or request needs triage New issue that requires triage

Comments

@wgy035
Copy link
Contributor

wgy035 commented Jul 24, 2024

Is your feature request related to a problem? Please describe.

While conducting a performance test, I discovered through flame graph analysis that the merge operation in the HttpServerMetrics.onEnd() causes performance overhead.
image

The startAttributes is generated by HttpCommonAttributesExtractor.onStart() and all attributes are extracted from request, could we move the attributes extract into HttpCommonAttributesExtractor.onEnd() to avoid merge in the HttpServerMetrics.onEnd()? I have reviewed the tracking code, the request will not be changed.

Describe the solution you'd like

I would like HttpCommonAttributesExtractor to extract attributes onEnd, so that it can be used in HttpServerMetrics directly. And startAttributes().toBuilder().putAll(endAttributes).build() is no longer needed.

Describe alternatives you've considered

No response

Additional context

No response

@wgy035 wgy035 added enhancement New feature or request needs triage New issue that requires triage labels Jul 24, 2024
@knarfli
Copy link

knarfli commented Jul 31, 2024

looked interesting, I want to take a look into it.

@wgy035 wgy035 linked a pull request Aug 7, 2024 that will close this issue
@wgy035
Copy link
Contributor Author

wgy035 commented Aug 7, 2024

I audited and tested most of AttributeExtractor.onEnd implementations, in each scenario, whether the attribute extract is executed in onStart or onEnd, the test results are the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage New issue that requires triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants