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

Profiles: Replace has_* fields with an enum. #595

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aalexand
Copy link

@aalexand aalexand commented Oct 31, 2024

The current has_* fields given 16 choices and most of those are not practical. This is a proposal to limit this to a more practical and guided set.

@aalexand
Copy link
Author

@jhalliday @felixge @florianl FYI - sending this for feedback.

@@ -423,6 +423,54 @@ message Label {
int64 num_unit = 4; // Index into string table
}

// Specifies the availability of the function and file names, line numbers and
// inline frames for a mapping.
enum SymbolizationLevel {
Copy link
Member

@christos68k christos68k Oct 31, 2024

Choose a reason for hiding this comment

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

@aalexand Why not have this as an attribute? (I admit I already forgot the relevant part in today's discussion). Looked up the mutability point in the agenda, and just to clarify: wouldn't this be either set once, at origin or if not set at origin, at a later point (e.g. in a processor)? Trying to understand why an attribute wouldn't be a fit here.

If it's just a matter of having to remove a previously set attribute, wouldn't this only apply to SYMBOLIZATION_LEVEL_UNSPECIFIED (which we can define as the absence of the attribute) or would we need more elaborate processing that takes more cases into account?

One reason that springs to mind is implementors not having to deal with OTel KeyValue which IIRC is a concern that you had in the past. Just wondering if there is something else, feel fee to correct my assumptions 😅

Copy link
Author

@aalexand aalexand Nov 1, 2024

Choose a reason for hiding this comment

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

The most elaborate "life of a profile" in terms of symbolization that I can think of is something like:

  1. A collector gathers a C++ profile. It sets the symbolization level to SYMBOLIZATION_LEVEL_NONE to indicate that only IP addresses are available and nothing else.
  2. The profile is transferred to the backend and stored there.
  3. The offline symbolizer processes the profile. At this point, initially, only stripped binary is available to the symbolizer so it symbolizes the profile at SYMBOLIZATION_LEVEL_SYMBOLS level.
  4. The offine symbolizer at some point gets full DWARF for the binary and re-symbolizes the profile, storing it with SYMBOLIZATION_LEVEL_LINES_INLINE level now.

The re-symbolization part is not something that all profilers may want to support, but I wanted to indicate that the level upgrade is possible.

Of course, replacing an attribute in a proto in memory is not a huge deal - iterate over the repeated opentelemetry.proto.common.v1.KeyValue attributes list and replace or append the attribute with the desired key and new value, but it's still microchurn and for something that is so common as symbolization level it feels that having a simple explicit field is nicer. But it's definitely not a dealbreaker, so I'd love to hear what others think.

As a side note, I wonder if it would be better if repeated opentelemetry.proto.common.v1.KeyValue attributes would be a map<Key, Value> instead. I thought maybe it's to support multi-value attributes, but there is an explicit support for lists in this type, so it's not that.

One other thing with commony used attributes also is that the definition of allowed values in their semantics is so far away from the proto itself. With an enum one gets compile-time checks, code completion etc. With attributes I don't even know what kind of presubmit or code generation support exists. This aspect probably shouldn't solely guide our decisions on what should be an attribute vs a field, but I think it's still a factor.

@yurishkuro yurishkuro removed their assignment Oct 31, 2024
@arminru arminru changed the title Replace has_* fields with an enum. Profiles: Replace has_* fields with an enum. Nov 5, 2024
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