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

[PROF-6691] Send span id in profiles as number and not string #2476

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Dec 7, 2022

What does this PR do?:

This PR changes the span id sent in profiling data (and used to power the "Code Hotspots" tab when viewing a trace) as a number in the underlying pprof, instead of as a string.

Motivation:

The numeric representation is smaller and also avoids needing to use the string table to represent this information.

We've wanted to do this change for a while, but only now was the profiling backend extended to support this.

Additional Notes:

The local root span id is still recorded as a string because there's a feature in libdatadog that relies/assumes this string representation.

I plan to later change libdatadog at a later time to allow us to send both values as a number.

This change affects only the new (still in alpha) Ruby profiler codepath, and thus is not expected to affect existing customers.

How to test the change?:

Change includes code coverage. Furthermore, you can validate this is working correctly by profiling an application that is generating traces, and checking that the "Code Hotspots" for spans show up correctly.

**What does this PR do?**:

This PR changes the `span id` sent in profiling data (and used to
power the "Code Hotspots" tab when viewing a trace) as a number in
the underlying pprof, instead of as a string.

**Motivation**:

The numeric representation is smaller and also avoids needing to use
the string table to represent this information.

We've wanted to do this change for a while, but only now was the
profiling backend extended to support this.

**Additional Notes**:

The `local root span id` is still recorded as a string because
there's a feature in libdatadog that relies/assumes this string
representation.

I plan to later change libdatadog at a later time to allow us to
send both values as a number.

**How to test the change?**:

Change includes code coverage. Furthermore, you can validate
this is working correctly by profiling an application that is
generating traces, and checking that the "Code Hotspots" for
spans show up correctly.
@ivoanjo ivoanjo requested a review from a team December 7, 2022 10:42
@github-actions github-actions bot added the profiling Involves Datadog profiling label Dec 7, 2022
@ivoanjo ivoanjo merged commit b9f1099 into master Dec 7, 2022
@ivoanjo ivoanjo deleted the ivoanjo/prof-6691-numeric-span-id branch December 7, 2022 11:51
@github-actions github-actions bot added this to the 1.8.0 milestone Dec 7, 2022
ivoanjo added a commit that referenced this pull request Jan 6, 2023
…tring

This is a newly-added feature to both the profiling backend, as well as
libdatadog.

Instead of sending the local root span ids as strings (that take up
space in the string table, etc), we can now send them as numbers.

We already did a similar migration for span ids in #2476, but at
the time we did not change the local root span ids because the
libdatadog `ddog_prof_Profile_set_endpoint` API could not properly
handle the numeric ids (this has been changed in
DataDog/libdatadog#80 ).

As far as testing goes, I could have chosen to abstract away this
change from our specs BUT I chose to make it explicit and changed the
specs to match. I like having visibility in the specs of the values
being encoded and passed around as numbers and not strings.
ivoanjo added a commit that referenced this pull request Feb 3, 2023
…tring

This is a newly-added feature to both the profiling backend, as well as
libdatadog.

Instead of sending the local root span ids as strings (that take up
space in the string table, etc), we can now send them as numbers.

We already did a similar migration for span ids in #2476, but at
the time we did not change the local root span ids because the
libdatadog `ddog_prof_Profile_set_endpoint` API could not properly
handle the numeric ids (this has been changed in
DataDog/libdatadog#80 ).

As far as testing goes, I could have chosen to abstract away this
change from our specs BUT I chose to make it explicit and changed the
specs to match. I like having visibility in the specs of the values
being encoded and passed around as numbers and not strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
profiling Involves Datadog profiling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants