dd-trace-php
dd-trace-php copied to clipboard
Heroku support?
Is there any documentation around setting this up within Heroku?
Hi, there isn't currently any documentation that refers to Heroku! I am not an expert of Heroku but it you stumbled into a specific issue we may be able to help!
What would be helpful is documentation supporting the installation of the extension onto Heroku. Thank you!
Thanks for suggesting this. Let me check on when we can schedule this task. It may take a little bit though because we may have to familiarize with Heroku in the first place!
So I can probably help: it took a few weeks and a lot of help from your support (thank you so much Wan for tracking down the root cause). In the end I needed to use a custom build pack, which I can share in a bit. I’ll provide another update here for folks looking to do this but it would also be helpful if DataDog establishes an official and documented path for this.
Hi @maxcountryman that would be awesome. If you can share your custom build pack than we can also include part of it in our official docs. Thanks a lot for this!
As promised, here are the details of how my team is currently enabling this on Heroku:
- We're using the heroku-buildpack-apt buildpack to install the released
.deb
; this buildpack looks for a file calledAptfile
in your app root which should contain the release you want to install, e.g.https://github.com/DataDog/dd-trace-php/releases/download/0.17.0/datadog-php-tracer_0.17.0_amd64.deb
. - As I mentioned, we also have to provide a custom configuration to PHP in order to load the tracing extension properly. That looks like this.
I'm assuming you're using the official Heroku PHP buildpack here and that these two buildpacks are ordered such that they are executed after the PHP buildpack and in the order listed above.
Hopefully this is helpful and is something that can eventually be addressed by documentation or a buildpack maintained by DataDog.
Thanks @maxcountryman for sharing this. I think it is pretty clear now what we should do to try it ourselves and add to the doc. We will post an update here with the link to the new section as soon as we can address this. Thanks a lot again!
Thanks @maxcountryman, I managed to figure out step 1 but looking at PHP info the extension was never enabled correctly so I'll try your step 2 suggestion. It's a shame this isn't covered in the docs as they kind of fall down at this point and I'm without any APM data in DataDog.
Step 2 worked perfectly, thanks so much.
For build pack order I went with this..will swap out your build pack of course ;)
heroku buildpacks:add --index 1 heroku/php
heroku buildpacks:add --index 2 https://github.com/DataDog/heroku-buildpack-datadog.git#1.17
heroku buildpacks:add --index 3 heroku-community/apt
heroku buildpacks:add --index 4 https://github.com/curology/heroku-buildback-curology/
Would it be possible to create an official Heroku buildpack for dd-trace-php? I found this excellent buildpack that incorporates the functionality of both the heroku-community/apt
and curology/heroku-buildback-curology
buildpacks described in this thread: SpeedCurve-Metrics/heroku-buildpack-php-ddtrace. It has config vars (aka environment variables for Heroku) for defining the version of dd-trace-php and PHP extension version.
This took me a long time to figure out. Heroku is ephemeral and the dd-trace-php extension can't be installed in the default location of /opt/. So buildpacks are required to install it to the correct location and enable the PHP extension (.ini file).
So for those also looking into how to do this as of today, you need 2 buildpacks after the php buildpack, and relevant config vars described in their documentation as needed:
I believe the PHP buildpack has to be before heroku-buildpack-php-ddtrace, otherwise the relevant php directory doesn't exist yet. I got this error with heroku/php last in the buildpack order:
touch: cannot touch '/app/.heroku/php/etc/php/conf.d/datadog-php-custom.ini': No such file or directory
Hey there 👋
I just want to give a heads up about the Buildpack from @SpeedCurve-Metrics. I created a PR at https://github.com/SpeedCurve-Metrics/heroku-buildpack-php-ddtrace/pull/4 to update it to use the datadog-setup.php
installer, which now also enables you to use the Profiler and AppSec.
Additionally I added this Buildpack to the list of Community Integrations in our official documentation.
@CaitlinWeb you are right, the heroku/php
buildpack has to go before the dd-trace-php
buildpack, especially with my PR, as we are using PHP to run the installer.
Hope this helps!