Prerequisites
- Prefect Cloud account or self-hosted Prefect Server
- API key (Prefect Cloud) or accessible API URL (self-hosted)
Setup
Option 1: Interactive CLI
Option 2: Persistent store
Add to~/.tracer/integrations.json:
| Field | Default | Description |
|---|---|---|
api_url | https://api.prefect.cloud/api | Prefect API URL (override for self-hosted) |
api_key | — | Prefect Cloud API key |
account_id | — | Prefect Cloud account ID |
workspace_id | — | Prefect Cloud workspace ID |
Prefect Cloud setup
- In Prefect Cloud, go to your profile icon → API Keys
- Click Create API Key
- Copy the key, account ID, and workspace ID from the URL:
https://app.prefect.cloud/account/<account-id>/workspace/<workspace-id>/
Self-hosted Prefect Server
For self-hosted Prefect Server, setapi_url to your server’s API endpoint (no API key required if unauthenticated):
Investigation tools
When OpenSRE investigates a Prefect-related alert, three diagnostic tools are available:- Flow runs — lists recent flow runs filtered by state (FAILED, CRASHED, etc.)
- Flow run logs — retrieves log output for a specific flow run
- Workers — checks worker health and heartbeat status across work pools
Troubleshooting
| Symptom | Fix |
|---|---|
| 401 Unauthorized | Check your API key and account/workspace IDs |
| Connection refused | Verify api_url is reachable — check firewall rules for self-hosted |
| No flow runs returned | Flow runs may have been purged — check retention settings |
Security best practices
- Use a service account API key rather than a personal key.
- For self-hosted, restrict network access to the Prefect API to trusted IPs.
- Store credentials in
~/.tracer/integrations.json, not in source code.