Getting container hostname from application

I’m sending custom metrics to Datadog from my application. Is there a way to get a container’s hostname from my application in order to correlate the custom metrics with Aptible-provided metrics from a Metric Drain?

Docker makes the container’s hostname available at /etc/hostname in the container so you can retrieve the hostname from this file. This is the same hostname used by the Aptible metrics and logging collectors.