8000 Optimize instance ID string generation by mariomac · Pull Request #417 · grafana/beyla · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Optimize instance ID string generation #417

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

Merged
merged 2 commits into from
Nov 8, 2023
Merged

Conversation

mariomac
Copy link
Contributor
@mariomac mariomac commented Nov 7, 2023

Addresses PR comment: #410 (comment)

Just for curiosity, some microbenchmarks results comparing Sprintf vs Itoa concatenation vs Cache:

BenchmarkSprintf-10   148740898               80.79 ns/op           32 B/op          2 allocs/op
BenchmarkItoa-10      447017748               26.96 ns/op           16 B/op          1 allocs/op
BenchmarkLRU-10       630053829               19.07 ns/op            0 B/op          0 allocs/op

@mariomac mariomac requested a review from grcevski as a code owner November 7, 2023 16:26
@codecov-commenter
Copy link
codecov-commenter commented Nov 7, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (e7711f6) 79.32% compared to head (ad16f5c) 44.25%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #417       +/-   ##
===========================================
- Coverage   79.32%   44.25%   -35.08%     
===========================================
  Files          61       59        -2     
  Lines        4876     4770      -106     
===========================================
- Hits         3868     2111     -1757     
- Misses        802     2530     +1728     
+ Partials      206      129       -77     
Flag Coverage Δ
integration-test ?
unittests 44.25% <75.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
pkg/internal/traces/read_decorator.go 76.92% <75.00%> (-2.15%) ⬇️

... and 42 files with indirect coverage changes

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

if instanceID, ok := idsCache.Get(spans[i].Pid.HostPID); ok {
spans[i].ServiceID.Instance = instanceID
} else {
spans[i].ServiceID.Instance = fullHostName + "-" + strconv.Itoa(int(spans[i].Pid.HostPID))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you missed adding to the cache on a miss?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah!

Copy link
Contributor
@grcevski grcevski left a comment

Choose a reason for hiding this comment

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

LGTM! Nice improvement!

@mariomac mariomac merged commit 8c950e0 into grafana:main Nov 8, 2023
@mariomac mariomac deleted the optimize-id branch November 8, 2023 16:40
mattdurham pushed a commit to mattdurham/beyla that referenced this pull request Jan 22, 2025
* Optimize instance ID string generation

* cache ids
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
0