Skip to content

Consistently use int64 type for string refs in pprofextended.#560

Closed
aalexand wants to merge 1 commit intoopen-telemetry:mainfrom
aalexand:fix-string-refs
Closed

Consistently use int64 type for string refs in pprofextended.#560
aalexand wants to merge 1 commit intoopen-telemetry:mainfrom
aalexand:fix-string-refs

Conversation

@aalexand
Copy link
Copy Markdown
Member

Fixing two fields that used a different type, I don't think there is a good reason to be inconsistent.

Fixing two fields that used a different type, I don't think there is a
good reason to be inconsistent.
@aalexand aalexand requested review from a team May 17, 2024 23:45
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented May 17, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: aalexand / name: Alexey Alexandrov (5b55fb7)

Copy link
Copy Markdown
Member

@felixge felixge left a comment

Choose a reason for hiding this comment

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

LGTM but @petethepig should confirm.

Copy link
Copy Markdown
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

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

Blocking temporarily until #559 is resolved.

uint64 locations_length = 8;
// A 128bit id that uniquely identifies this stacktrace, globally. Index into string table. [optional]
uint32 stacktrace_id_index = 9;
int64 stacktrace_id_index = 9;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Semi off-topic, but was wondering if it would make sense to change this field. I feel that the space savings of referencing the string table might not be that big and it's not clear what encoding this would have in the string table (base64? ascii? would the string have to be unicode? etc):

  • two uint64, storing the high and low bits for the stack ID;
  • a bytes field;
  • if we want to keep the indexed approach, maybe we could move this to a new repeated field in the Profile message;

curious on your thoughts here! cc @florianl

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Using bytes or string would mean another indirection / dynamic allocation for the in-memory representation so I would be careful with that.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That's a good point. I personally prefer having this as two uint64s but not sure if everyone would agree with the slightly increase in memory. I am not a protobuf expert, I am assuming that adding the extra uint64 field would increase the size of the message by 10 Bytes if I am understanding the docs right

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The concept of a stacktrace_id is new and google/pprof doesn't know this element. It originates from the original optimyze stateful protocol and helped two communicate how often a trace was seen, while not sending the full stack trace every time. Back then, we went with 128bit as we wanted the stacktrace IDs to be globally unique and reduce collisions. I'm not sure how this field is used by other implementations of the protocol. So having stacktrace_id_index as a index into the string table is the most flexible way for the moment, I think.

It is just the type of the filed, that needs better alignment. For every index int64 is used (also in google/pprof) and so the current type of uint32 should change and align.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Makes sense, in that case, should we update the comment and leave the number of bits for the stack id unspecified?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure how relevant this PR is anymore, after the discussion around the google/pprof donation in the last meeting. There are some cases where the profiling protocol can and should evolve and maybe this is one of them.


// Type of frame (e.g. kernel, native, python, hotspot, php). Index into string table.
uint32 type_index = 6;
int64 type_index = 6;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Duplicate of #557

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As #557 got merged, this should no longer be relevant.

@tigrannajaryan
Copy link
Copy Markdown
Member

I removed my block, the PR can progress.

uint64 locations_length = 8;
// A 128bit id that uniquely identifies this stacktrace, globally. Index into string table. [optional]
uint32 stacktrace_id_index = 9;
int64 stacktrace_id_index = 9;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This field got removed with #575. Maybe we can close the PR now?

@aalexand aalexand closed this Sep 4, 2024
@aalexand aalexand deleted the fix-string-refs branch September 4, 2024 22:39
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.

6 participants