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”{ "git_sha": "abc123def456", "version": "v1.2.3", "deployer": "github-actions", "env": "production", "description": "Fix payment processing bug", "timestamp": "2024-01-15T14:30:00Z"}Fields
Section titled “Fields”| Field | Type | Required | Description |
|---|---|---|---|
git_sha | string | Yes | Git commit SHA |
version | string | No | Version tag or number |
env | string | No | Target environment |
deployer | string | No | Who/what triggered the deploy |
description | string | No | Deploy description |
timestamp | string | No | ISO 8601 timestamp (defaults to now) |
Response
Section titled “Response”Returns 202 Accepted on success with no response body.
Example
Section titled “Example”curl -X POST http://localhost:3000/ingest/deploys \ -H "Authorization: Bearer proj_abc123..." \ -H "Content-Type: application/json" \ -d '{ "git_sha": "abc123def456789", "version": "v1.2.3", "deployer": "github-actions", "env": "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 "{ \"git_sha\": \"${{ github.sha }}\", \"version\": \"${{ github.ref_name }}\", \"deployer\": \"github-actions\", \"env\": \"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 "{ \"git_sha\": \"$CI_COMMIT_SHA\", \"version\": \"$CI_COMMIT_TAG\", \"deployer\": \"gitlab-ci\", \"env\": \"$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 '{\"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 "{ \"git_sha\": \"$HEROKU_SLUG_COMMIT\", \"version\": \"$HEROKU_RELEASE_VERSION\", \"deployer\": \"heroku\" }"hooks: post-deploy: - | curl -X POST $MINIAPM_URL/ingest/deploys \ -H "Authorization: Bearer $MINIAPM_API_KEY" \ -H "Content-Type: application/json" \ -d '{"git_sha": "<%= `git rev-parse HEAD`.strip %>", "version": "<%= `git describe --tags --always`.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
- Deploy timeline showing all deployments
- Correlation between deploys and performance changes
Best Practices
Section titled “Best Practices”- Always include git_sha - It’s the only required field and 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 env - Track staging vs production separately