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: mark Line.function_index optional #621

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

Conversation

florianl
Copy link
Contributor

@florianl florianl commented Feb 7, 2025

Similar to Location.mapping_index also mark Line.function_index optional.

For visibility: @open-telemetry/profiling-maintainers

Similar to Location.mapping_index also mark Line.function_index optional.

Signed-off-by: Florian Lehner <[email protected]>
@florianl florianl requested review from a team as code owners February 7, 2025 08:08
Comment on lines 477 to 478
// Line number in source file.
int64 start_line = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make a note here? 0 if not available/making it optional?

Copy link
Member

@christos68k christos68k Feb 7, 2025

Choose a reason for hiding this comment

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

@florianl I thought the consensus in the last SIG was that we'd use optional everywhere?

Copy link
Contributor Author

@florianl florianl Feb 7, 2025

Choose a reason for hiding this comment

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

My understanding was, that we use optional for function_index, similar to optional int32 mapping_index = 1; to have consistency. And improve on the documentation of the fields within message Function, pointing to the special meaning of Profile.string_table[0], if there is no value.

But i'm happy to also mark all fields within message Functionwith optional.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see it written down in the agenda but I do remember the point of "specialness" for tracking a missing value for strings was raised and the final consensus was to use optional. Maybe @felixge can chime in.

Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately I don't recall if we decided to change how we handle strindex fields (we should capture notes better), but thinking more about this I would propose we leave them without optional keyword and with special zero index value meaning empty for now. We can discuss later.

Motivation: optional field at least in Go are encoded at runtime as a field by pointer rather than by value, so if we make them all optional we end up with a lot more "*int32" fields instead of "int32". These dynamic allocations can add up and have memory usage and GC CPU costs.

int32 filename_strindex = 3; // Index into string table
// Index into Profile.string_table to the name of the function, in
// human-readable form.
// Use index 0 if value is not available.
Copy link
Member

Choose a reason for hiding this comment

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

Describing the semantics of how we index strings at every field is becoming repetitive IMO.

For *_strindex fields I would suggest we focus the documentation on the semantics of this string field. The strindex itself points to the fact that this is a string index, with the same meaning universally (including index 0 for empty value).

So, maybe put the documentation simply as

  // Function name. Empty string if not available.
  int32 name_strindex = 1;
  // Function name, as identified by the system. For instance,
  // it can be a C++ mangled name. Empty string if not available.
  int32 system_name_strindex = 2;
  // Source file containing the function. Empty string if not available.
  int32 filename_strindex = 3;
  ...

?

Comment on lines 477 to 478
// Line number in source file.
int64 start_line = 4;
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately I don't recall if we decided to change how we handle strindex fields (we should capture notes better), but thinking more about this I would propose we leave them without optional keyword and with special zero index value meaning empty for now. We can discuss later.

Motivation: optional field at least in Go are encoded at runtime as a field by pointer rather than by value, so if we make them all optional we end up with a lot more "*int32" fields instead of "int32". These dynamic allocations can add up and have memory usage and GC CPU costs.

@florianl florianl marked this pull request as draft February 20, 2025 16:28
@florianl
Copy link
Contributor Author

The Profiling SIG (2025-02-20) wants to explore the protobuf Opaque API first - before making further steps.

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.

4 participants