A Python-based Prometheus exporter that collects usage statistics (requests, costs, status codes) from the Zyte API Dashboard.
This exporter scrapes the Zyte Dashboard API to retrieve daily cumulative metrics (from 00:00 UTC to current time) and exposes them for Prometheus consumption.
- Exports total request counts.
- Exports total cost (in micro USD).
- Exports request counts grouped by HTTP status codes.
- Lightweight and Docker-ready.
- Handles graceful shutdown (Docker stop).
To use this exporter, you need credentials from the Zyte Dashboard, not your standard proxy API key.
- Organization ID: Found in your dashboard URL (e.g.,
https://app.zyte.com/o/123456/...->123456). - Dashboard API Key: Generate one at Zyte Organization Settings.
-
Build the image
docker build -t zyte-exporter . -
Run the container
docker run -d \ -p 9188:9188 \ -e ZYTE_DASHBOARD_API_KEY="YOUR_DASHBOARD_API_KEY" \ -e ZYTE_ORG_ID="YOUR_ORG_ID" \ --name zyte-exporter \ zyte-exporter
-
Install dependencies
pip install prometheus-client requests
-
Set environment variables and run
export ZYTE_DASHBOARD_API_KEY="YOUR_DASHBOARD_API_KEY" export ZYTE_ORG_ID="YOUR_ORG_ID" python zyte_exporter.py
The exporter exposes metrics on port 9188 (default).
| Metric Name | Type | Description |
|---|---|---|
zyte_requests_total |
Counter | Total number of requests sent today (UTC). |
zyte_cost_microusd_total |
Counter | Total cost incurred today in Micro USD. |
zyte_requests_status_total |
Counter | Count of requests grouped by status code (label: code). |
Note: Metrics are reset daily at 00:00 UTC by the Zyte API.
Add the following job to your prometheus.yml:
scrape_configs:
- job_name: 'zyte-exporter'
scrape_interval: 60s
static_configs:
- targets: ['your-exporter-host:9188']This project is licensed under the MIT License - see the LICENSE file for details.