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-4535] Switch profiling to use intake 1.3 format #1820

Merged
merged 5 commits into from
Jan 7, 2022

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Jan 5, 2022

Although not stated explicitly, the Ruby profiler was previously using the 1.2 intake format.

The 1.3 format (lightly documented here [Datadog-internal link, apologies]) shuffles around the fields a bit:

  • recording-start => start
  • recording-end => end
  • data[0] + types[0] => data[somefilename]
  • runtime => family
  • format is removed
  • version is added

This change is not observable to customers; but is a requirement to submitting extra files along with profiles, as we plan to do in #1813.

I also included a few cleanups to the specs; I suggest reviewing this PR commit-by-commit.

Since this PR needs some profiling-backend specific knowledge to validate (aka that I'm using the v3 format correctly), I'll also find someone from the Profiling team to do a pass on those bits.

P.s.: CI is broken due to unrelated reasons. Will be tackled separately.

This behavior was removed in #1166 but a test was left behind that no
longer was relevant.
These tests don't actually need an agent (they open their own web
server), and I can't think of a reason not to run them by default, like
we do for other similar tests.
By avoiding such constants we:

1. Make our tests more independent of the actual code being tested --
   we can freely refactor the internal structure and where we store
   the constants, as long as the result is the same.

2. Actually validate the expected payload in the tests. E.g., if a
   field is renamed, that change MUST be reflected in the tests and
   thus it becomes very obvious that such a change was made.
Although not stated explicitly, the Ruby profiler was previously
using the 1.2 intake format.

The 1.3 format (lightly documented
[here](https://github.com/DataDog/profiling-backend/blob/prod/README.md#v3-intake-format-used-by-go-net-native)
[Datadog-internal link, apologies]) shuffles around the fields a bit:

* `recording-start` => `start`
* `recording-end` => `end`
* `data[0]` + `types[0]` => `data[somefilename]`
* `runtime` => `family`
* `format` is removed
* `version` is added

This change is not observable to customers; but
is a requirement to submitting extra files along with profiles,
as we plan to do in #1813.
This left an open socket behind, which conflicted with other specs.
@ivoanjo ivoanjo force-pushed the ivoanjo/prof-4535-profiling-use-intake-1.3-format branch from 778e031 to 3639187 Compare January 6, 2022 09:23
@codecov-commenter
Copy link

Codecov Report

Merging #1820 (3639187) into master (668146c) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1820      +/-   ##
==========================================
- Coverage   98.21%   98.21%   -0.01%     
==========================================
  Files         931      931              
  Lines       44920    44909      -11     
==========================================
- Hits        44120    44109      -11     
  Misses        800      800              
Impacted Files Coverage Δ
lib/ddtrace/ext/profiling.rb 100.00% <100.00%> (ø)
...b/ddtrace/profiling/transport/http/api/endpoint.rb 100.00% <100.00%> (ø)
...ng/transport/http/adapters/net_integration_spec.rb 100.00% <100.00%> (ø)
...race/profiling/transport/http/api/endpoint_spec.rb 100.00% <100.00%> (ø)
...ce/transport/http/adapters/net_integration_spec.rb 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 668146c...3639187. Read the comment docs.

Comment on lines -26 to -32
FORM_FIELD_DATA = 'data[0]'.freeze
FORM_FIELD_FORMAT = 'format'.freeze
FORM_FIELD_FORMAT_PPROF = 'pprof'.freeze
FORM_FIELD_RECORDING_END = 'recording-end'.freeze
FORM_FIELD_RECORDING_START = 'recording-start'.freeze
FORM_FIELD_RUNTIME = 'runtime'.freeze
FORM_FIELD_RUNTIME_ID = 'runtime-id'.freeze
Copy link
Member

Choose a reason for hiding this comment

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

Just to confirm, we don't need to support version 1.2 anymore at all?

I ask because, for tracing when we introduce a new transport version, we normally keep the old one as the user's Datadog agent might not be up to date with the latest transport version yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a great question :)

We don't need to support the old version at all because for profiling, there's no format-specific logic in the agent. The agent just acts as a rather dumb proxy -- receives stuff from the library and then repeats it back to the profiling backend.

So we are free to make these changes.

Also, there aren't yet any plans to sunset the old format, so older versions of the profiler will continue to work (but we always recommend being on the latest!).

Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

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

Looks good, left one comment. 👍

@ivoanjo ivoanjo merged commit 6ee2e72 into master Jan 7, 2022
@ivoanjo ivoanjo deleted the ivoanjo/prof-4535-profiling-use-intake-1.3-format branch January 7, 2022 10:02
@github-actions github-actions bot added this to the 0.55.0 milestone Jan 7, 2022
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