Deploys API
Track deployments to correlate releases with performance changes and error rates.
Endpoint
Section titled “Endpoint”POST /ingest/deploysHeaders
Section titled “Headers”| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <api_key> |
Content-Type | Yes | application/json |
Request Body
Section titled “Request Body”{ "version": "v1.2.3", "git_sha": "abc123def456", "deployer": "github-actions", "environment": "production", "description": "Fix payment processing bug", "deployed_at": "2024-01-15T14:30:00Z"}Fields
Section titled “Fields”| Field | Type | Required | Description |
|---|---|---|---|
version | string | No | Version tag or number |
git_sha | string | No | Git commit SHA |
deployer | string | No | Who/what triggered the deploy |
environment | string | No | Target environment |
description | string | No | Deploy description |
deployed_at | string | No | ISO 8601 timestamp (defaults to now) |
At least one of version or git_sha should be provided.
Response
Section titled “Response”Success (200)
Section titled “Success (200)”{ "id": "deploy_abc123", "version": "v1.2.3", "deployed_at": "2024-01-15T14:30:00Z"}Example
Section titled “Example”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" }'CI/CD Integration
Section titled “CI/CD Integration”GitHub Actions
Section titled “GitHub Actions”- 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
Section titled “GitLab CI”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\" }"Capistrano
Section titled “Capistrano”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\"}'" endendHeroku
Section titled “Heroku”# In your release phase or post-deploy hookcurl -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\" }"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"}'Ruby Integration
Section titled “Ruby Integration”Using the miniapm gem:
# In your deploy script or initializerMiniAPM.record_deploy( version: ENV['APP_VERSION'], git_sha: ENV['GIT_SHA'], deployer: 'my-deploy-script')Dashboard Features
Section titled “Dashboard Features”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
Best Practices
Section titled “Best Practices”- Always include git_sha - Makes it easy to identify exact code versions
- Use meaningful version tags - Semver or date-based versions work well
- Record deploys after success - Only notify after deploy completes
- Include environment - Track staging vs production separately