Skip to content

Deploys API

Track deployments to correlate releases with performance changes and error rates.

POST /ingest/deploys
HeaderRequiredDescription
AuthorizationYesBearer <api_key>
Content-TypeYesapplication/json
{
"version": "v1.2.3",
"git_sha": "abc123def456",
"deployer": "github-actions",
"environment": "production",
"description": "Fix payment processing bug",
"deployed_at": "2024-01-15T14:30:00Z"
}
FieldTypeRequiredDescription
versionstringNoVersion tag or number
git_shastringNoGit commit SHA
deployerstringNoWho/what triggered the deploy
environmentstringNoTarget environment
descriptionstringNoDeploy description
deployed_atstringNoISO 8601 timestamp (defaults to now)

At least one of version or git_sha should be provided.

{
"id": "deploy_abc123",
"version": "v1.2.3",
"deployed_at": "2024-01-15T14:30:00Z"
}
Terminal window
curl -X POST http://localhost:3000/ingest/deploys \
-H "Authorization: Bearer proj_abc123..." \
-H "Content-Type: application/json" \
-d '{
"version": "v1.2.3",
"git_sha": "abc123def456789",
"deployer": "github-actions",
"environment": "production"
}'
.github/workflows/deploy.yml
- name: Notify MiniAPM
run: |
curl -X POST ${{ secrets.MINIAPM_URL }}/ingest/deploys \
-H "Authorization: Bearer ${{ secrets.MINIAPM_API_KEY }}" \
-H "Content-Type: application/json" \
-d "{
\"version\": \"${{ github.ref_name }}\",
\"git_sha\": \"${{ github.sha }}\",
\"deployer\": \"github-actions\",
\"environment\": \"production\"
}"
.gitlab-ci.yml
notify_miniapm:
stage: deploy
script:
- |
curl -X POST $MINIAPM_URL/ingest/deploys \
-H "Authorization: Bearer $MINIAPM_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"version\": \"$CI_COMMIT_TAG\",
\"git_sha\": \"$CI_COMMIT_SHA\",
\"deployer\": \"gitlab-ci\",
\"environment\": \"$CI_ENVIRONMENT_NAME\"
}"
config/deploy.rb
after :finishing, :notify_miniapm do
on roles(:app) do
execute :curl, "-X POST #{ENV['MINIAPM_URL']}/ingest/deploys",
"-H 'Authorization: Bearer #{ENV['MINIAPM_API_KEY']}'",
"-H 'Content-Type: application/json'",
"-d '{\"version\": \"#{fetch(:current_revision)}\", \"git_sha\": \"#{fetch(:current_revision)}\", \"deployer\": \"capistrano\"}'"
end
end
Terminal window
# In your release phase or post-deploy hook
curl -X POST $MINIAPM_URL/ingest/deploys \
-H "Authorization: Bearer $MINIAPM_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"version\": \"$HEROKU_RELEASE_VERSION\",
\"git_sha\": \"$HEROKU_SLUG_COMMIT\",
\"deployer\": \"heroku\"
}"
config/deploy.yml
hooks:
post-deploy:
- |
curl -X POST $MINIAPM_URL/ingest/deploys \
-H "Authorization: Bearer $MINIAPM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"version": "<%= `git describe --tags --always`.strip %>", "git_sha": "<%= `git rev-parse HEAD`.strip %>", "deployer": "kamal"}'

Using the miniapm gem:

# In your deploy script or initializer
MiniAPM.record_deploy(
version: ENV['APP_VERSION'],
git_sha: ENV['GIT_SHA'],
deployer: 'my-deploy-script'
)

Once deploys are recorded, you’ll see:

  • Deploy markers on performance graphs
  • Before/after comparisons for error rates and latency
  • Deploy timeline showing all deployments
  • Correlation between deploys and performance changes
  1. Always include git_sha - Makes it easy to identify exact code versions
  2. Use meaningful version tags - Semver or date-based versions work well
  3. Record deploys after success - Only notify after deploy completes
  4. Include environment - Track staging vs production separately