Opbeat is joining forces with Elastic – Learn more about Elastic APM

Release tracking with Fabric

Release tracking extracts information regarding the current revision of your repository and sends it to Opbeat when you deploy new code with Fabric.

1. Notify Opbeat when a release has completed

Add the following to your fabfile.py to track deployments:

from fabric.api import runs_once, lcd, local, task

def register_deployment(git_path):
        revision = local('git log -n 1 --pretty="format:%H"', capture=True)
        branch = local('git rev-parse --abbrev-ref HEAD', capture=True)
        local('curl https://intake.opbeat.com/api/v1/organizations/<organization-id>/apps/<app-id>/releases/'
              ' -H "Authorization: Bearer <secret-token>"'
              ' -d rev={}'
              ' -d branch={}'
              ' -d status=completed'.format(revision, branch))

Make sure to replace <organization-id>, <app-id> and <secret-token> with the appropriate values for your app. You can find them under Keys and tokens in your application’s settings.

Call register_deployment with a local path that contains a .git directory after a release has been deployed.