Skip to content

Build and package datadog-profiling in CI#1663

Merged
morrisonlevi merged 28 commits into
masterfrom
levi/profiling-build
Aug 1, 2022
Merged

Build and package datadog-profiling in CI#1663
morrisonlevi merged 28 commits into
masterfrom
levi/profiling-build

Conversation

@morrisonlevi

@morrisonlevi morrisonlevi commented Jul 20, 2022

Copy link
Copy Markdown
Collaborator

Description

This adds jobs to the build_packages workflow in CircleCI that build
the datadog-profiling extension on x86_64-unknown-linux-gnu and
x86_64-alpine-linux-musl. It adjusts the datadog-setup.php install
script to use extension = datadog-profiling.so instead of
zend_extension = datadog-profiling.so and checks for profiling
dependencies that weren't there before, which depending on your OS
includes libgcc_s, libdl, libpthread, and librt.

This also updated the Alpine images to v3.16, which caused a few things
to break in CI. I fixed one of them already, but there's still an issue
with the warning return-local-addr. This was beyond my skill to just
drop in and fix quickly, so I dropped in a
-Wno-error=return-local-addr that should be removed once the fix is
in place. In the testing I did, the tracer built from this workflow can
run on Alpine 3.11 and earlier for x86-64, but I suspect for arm it
will not be possible to due to the libmusl v1.2 upgrade that happens
on Alpine 3.13.

Readiness checklist

  • Changelog has been added to the release document.
  • Tests added for this feature/bug.

Reviewer checklist

  • Appropriate labels assigned.
  • Milestone is set.

Base automatically changed from levi/profiling-ci to master July 20, 2022 19:28
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch from 142e56b to eb82471 Compare July 20, 2022 22:25
This is because my Internet connection sucks at the moment and I
need to minimize total size _and_ individual layer size. As a bonus,
the extra time spent here means that more layers get shared than
before.

Also temporarily allow `-Wno-error=return-local-addr`; these started
showing up after the Alpine 3.16 upgrade. It needs a tracer engineer
to look at it, so for now I'm just allowing it so I can work in
parallel.
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch 2 times, most recently from 1c95b20 to af061e3 Compare July 22, 2022 04:56
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch from af061e3 to 2903a62 Compare July 22, 2022 05:11
This is simpler to implement in Rust because it avoid global mutable
state in favor of lazy initialization.

It does have the unfortunate side-effect that if the profiler is
installed but disabled and the user clicks on the Code Hotspots tab,
then the app will try to find associated profiles even though there
won't be any.
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch from 4454302 to e02c8a1 Compare July 23, 2022 00:38
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch from d75d9ed to 286923f Compare July 25, 2022 21:34
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch 2 times, most recently from d2de1c8 to 09ff06b Compare July 25, 2022 22:24
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch from 09ff06b to 3de065c Compare July 25, 2022 22:46
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch 3 times, most recently from 2965a0e to 320c831 Compare July 26, 2022 20:34
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch from 9224be5 to bb53bcc Compare July 27, 2022 16:53
@morrisonlevi
morrisonlevi force-pushed the levi/profiling-build branch from bb53bcc to 3f7f355 Compare July 27, 2022 20:07
This shaves off about 40s of link time. I haven't profiled performance
yet _at all_ so this is fine.
This saves some time in the CI, as this is on the slowest path to
the "package extension" job.
Overall this will cost more CI resources but cuts off around 90s
of build time.
@morrisonlevi morrisonlevi added this to the 0.77.0 milestone Jul 28, 2022
@morrisonlevi morrisonlevi added dev/testing profiling Relates to the Continuous Profiler labels Jul 28, 2022
@morrisonlevi morrisonlevi changed the title Build and package profiler Build and package datadog-profiling in CI Jul 28, 2022
@morrisonlevi
morrisonlevi marked this pull request as ready for review July 28, 2022 04:29
@morrisonlevi
morrisonlevi requested review from a team as code owners July 28, 2022 04:29
Comment thread .circleci/config.yml
- restore_cache:
name: Restore Cargo Package Cache
keys:
- profiling-cargo-cache-<< parameters.triplet >>-{{ checksum "profiling/Cargo.toml" }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This key looks nice to me

curl -L -o $tmp_folder_profiling_archive $profiling_url

# Profiling: C version
#curl -L -o $tmp_folder_profiling_archive $profiling_url

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This does make it easy to revert back. Just flagging it so I remember.

r1viollet
r1viollet previously approved these changes Jul 28, 2022

@r1viollet r1viollet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some nice optimisations to get the Rust build times down.
I think we could have even more caching. To be discussed for next PR, this is already big !
Congrats on putting all of this together. It must have been some amount of iterations.

bwoebi
bwoebi previously approved these changes Jul 29, 2022

@bwoebi bwoebi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this looks great to me. I'm not sure whether we need that extra package_profiling step, but it does no harm, so, let's move on :-)

@morrisonlevi

morrisonlevi commented Jul 29, 2022

Copy link
Copy Markdown
Collaborator Author

I took at look at "package profiling" and I think it does about 1 minute of harm! It spends about 1 minute downloading the container, attaching the workspace, re-uploading the workspace, etc for just 10ish seconds of work. We can just do those things in "package extension". Good eye!

@morrisonlevi
morrisonlevi dismissed stale reviews from bwoebi and r1viollet via dbcf89d July 29, 2022 20:03

@bwoebi bwoebi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That seems to shave off a couple seconds. Guess there's nothing left to optimize now.

@r1viollet r1viollet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good thinking on these last optims !
LGTM

@morrisonlevi
morrisonlevi merged commit d8daab4 into master Aug 1, 2022
@morrisonlevi
morrisonlevi deleted the levi/profiling-build branch August 1, 2022 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev/testing profiling Relates to the Continuous Profiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants