Skip to content

[pkg/ottl] Accessors for profile attributes #39681

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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

rockdaboot
Copy link
Contributor

@rockdaboot rockdaboot commented Apr 28, 2025

Description

Adds support for profile.attributes to OTTL.

This allows users to use profile.attributes without deeper knowledge of the protocol internals.
Currently, users have to deal with attribute_table and attribute_indices, which is error-prone and fragile when the experimental profiling signal changes internal representation.

This change depends on open-telemetry/opentelemetry-collector#12798 and thus includes that PR. It will be removed as soon as possible.

The profiles support for the transformprocessor currently relies/waits on this change.

@github-actions github-actions bot requested a review from kentquirk April 28, 2025 08:20
@rockdaboot rockdaboot marked this pull request as draft April 28, 2025 08:20
@rockdaboot rockdaboot force-pushed the profiles-attribute-accessors branch from 3d6044b to ecc282f Compare April 28, 2025 08:23
@rockdaboot rockdaboot changed the title [chore] [pkg/ottl] Accessors for profile attributes [pkg/ottl] Accessors for profile attributes Apr 28, 2025
@rockdaboot rockdaboot force-pushed the profiles-attribute-accessors branch from ecc282f to 6745566 Compare April 29, 2025 07:32
@rockdaboot rockdaboot marked this pull request as ready for review April 29, 2025 07:33
}
tCtx.GetProfile().AttributeIndices().FromRaw([]int32{})
for k, v := range m.All() {
if err := PutAttribute(tCtx.GetProfile().AttributeTable(), tCtx.GetProfile(), k, v); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm probably missing something, but I wish we could make it more efficient. I understand why PutAttribute/ AddAttribute are that complex, but considering all the complexity around the profiles attributes read/write operations, and how slower it probably is compared to other pdata attributes (specially inside a loop), IMO, all the space complexity/reusability benefits we got from using this structure for profiles, maybe didn't worth it. It would be nice to have some pdata helpers/wrappers that makes it faster/easier to handle (just a thought, not a suggestion).

Copy link
Contributor Author

@rockdaboot rockdaboot May 8, 2025

Choose a reason for hiding this comment

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

I basically agree, but would wait until it turns out to be a bottleneck in the real world. Though, if we already know that there are use cases were hundreds or maybe thousands of attributes exist per message, then we should bring it up at the profiling SIG meeting.

@edmocosta edmocosta marked this pull request as draft May 5, 2025 15:28
@edmocosta
Copy link
Contributor

edmocosta commented May 5, 2025

Please mark it as ready for review when open-telemetry/opentelemetry-collector#12798 gets merged. Thanks.

@rockdaboot rockdaboot force-pushed the profiles-attribute-accessors branch 2 times, most recently from 3657b38 to df8e707 Compare May 8, 2025 15:38
@rockdaboot rockdaboot force-pushed the profiles-attribute-accessors branch from 53d4312 to cbd181f Compare May 27, 2025 08:42
@rockdaboot
Copy link
Contributor Author

@edmocosta The pdata PutAttribute function now has been merged and adopted in this PR.

I'd still wait for #39952 until marking this PR as ready to review.

atoulme pushed a commit that referenced this pull request May 27, 2025
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Access to these lookup tables isn't really useful, as they only provide
a slice of values, and we can't check which one is being used by the
current profile.
Also, with
open-telemetry/opentelemetry-collector#13075,
the lookup tables are moving out of the profile and into a new
dictionary object.

So as a first step to the proto migration, this removes access to the
lookup tables for a profile.
The replacement for this is
#39681,
which will give acces to the profile attributes, as we do with other
signals and abstract away the lookup tables.

---------

Co-authored-by: Edmo Vamerlatti Costa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants