-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add BuildAttributes helper to pprofile #12176
base: main
Are you sure you want to change the base?
Add BuildAttributes helper to pprofile #12176
Conversation
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (45.16%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #12176 +/- ##
==========================================
- Coverage 91.75% 91.69% -0.06%
==========================================
Files 464 465 +1
Lines 24763 24794 +31
==========================================
+ Hits 22722 22736 +14
- Misses 1656 1673 +17
Partials 385 385 ☔ View full report in Codecov by Sentry. |
4dc8a4a
to
e0a0548
Compare
m := pcommon.NewMap() | ||
|
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.
m.EnsureCapacity(record.AttributeIndices().Len())
key := a.Key() | ||
val := a.Value() | ||
|
||
switch val.Type() { |
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.
Simply replace whole switch statement with: val.CopyTo(m.PutEmpty(key))
id := int(record.AttributeIndices().At(i)) | ||
a := profile.AttributeTable().At(id) |
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.
kv := profile.AttributeTable().At(int(record.AttributeIndices().At(i)))
The blocking request part is resolved.
|
||
// BuildAttributes builds a [pcommon.Map] containing the attributes of a record. | ||
// The record can by any struct that implements an `AttributeIndices` method. | ||
func BuildAttributes(profile Profile, record attributable) pcommon.Map { |
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 would probably use something like FromAttributeIndices
?
|
||
// BuildAttributes builds a [pcommon.Map] containing the attributes of a record. | ||
// The record can by any struct that implements an `AttributeIndices` method. | ||
func BuildAttributes(profile Profile, record attributable) pcommon.Map { |
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.
Should this be a func on Profile
then? Or actually, you only need the AttributeIndices
not the whole Profile correct?
Description
Profiles attributes are stored in a single
AttributeTable
attribute, and then referenced in each substruct asAttributeIndices
.This means to read them as a
pcommon.Map
, a bit of pre-processing is required.This adds an helper method so each component manipulating profiles doesn't have to reimplement it.
Benchmark: