Heroku Labs: Dyno Metadata
Last updated 09 October 2019
Dyno metadata gives the dyno easy access to information about the app and environment. Examples of available dyno metadata include details about the release, dyno size, application name as well as the unique identifier for the particular running dyno.
Dyno metadata can be used to:
Get release information: Knowing which git SHA of the release your dyno is running is useful for continuous integration, callbacks, and debugging.
Easily access the application name: Knowing your application name can make debugging easier when you are running multiple versions of the same application across regions.
Features added through Heroku Labs are experimental and subject to change.
Dyno processes are able to inspect metadata as config vars set in the dyno. For an app to get these variables, you must first enable the labs feature on the application.
You can enable this by running:
$ heroku labs:enable runtime-dyno-metadata -a <app name>
The metadata will be available the next time you deploy the app.
The following dyno metadata will be made available:
|HEROKU_APP_ID||The unique identifier for the application.||
|HEROKU_APP_NAME||The application name.||
|HEROKU_DYNO_ID||The dyno identifier. This metadata is not yet available in Private Spaces nor the Container Registry.||
|HEROKU_RELEASE_CREATED_AT||The time and date the release was created.||
|HEROKU_RELEASE_VERSION||The identifier for the current release.||
|HEROKU_SLUG_COMMIT||The commit hash for the current release.||
|HEROKU_SLUG_DESCRIPTION||The description of the current release.||
In certain situations, such as pushing a tarball manually using the Releases API, the slug commit hash may be null.
It is not recommended that you set HEROKU_* environment variables on your application as it runs the risk of conflicting with these changes.
Example dyno metadata
$ env HEROKU_APP_ID: 9daa2797-e49b-4624-932f-ec3f9688e3da HEROKU_APP_NAME: example-app HEROKU_DYNO_ID: 1vac4117-c29f-4312-521e-ba4d8638c1ac HEROKU_RELEASE_CREATED_AT: 2015-04-02T18:00:42Z HEROKU_RELEASE_VERSION: v42 HEROKU_SLUG_COMMIT: 2c3a0b24069af49b3de35b8e8c26765c1dba9ff0 HEROKU_SLUG_DESCRIPTION: Deploy 2c3a0b2 ...
If you no longer wish to participate in this lab, please remove the lab from your app and then remove any config vars you may not want. Out of concern for removing config vars that your application may be depending upon, removal of the lab will not remove config vars at this time. As with all labs, this functionality is experimental and may change.
You can disable the continued updating of the config vars by opting out of the lab:
$ heroku labs:disable runtime-dyno-metadata -a <app name>
You can remove the config vars by unsetting any you wish to remove. Here we remove all config vars set by this feature:
$ heroku config:unset HEROKU_APP_ID HEROKU_APP_NAME HEROKU_DYNO_ID \ HEROKU_RELEASE_CREATED_AT HEROKU_RELEASE_VERSION HEROKU_SLUG_COMMIT \ HEROKU_SLUG_DESCRIPTION -a <app name>