This guide covers the monitoring capabilities of ON1Builder, including metrics, logs, alerting, and dashboards for keeping track of your system's performance and status.
flowchart TB
subgraph ON1Builder[ON1Builder System]
Core[Core System]
Workers[Chain Workers]
Safety[Safety Net]
TX[Transaction System]
end
subgraph Monitoring[Monitoring System]
Logs[(Log Files)]
Metrics[(Metrics Store)]
Alerting[Alert Manager]
end
subgraph Visualization[Visualization Tools]
Grafana[Grafana Dashboards]
Console[Console Output]
end
subgraph Notifications[Notification Channels]
Email[Email Alerts]
Slack[Slack Notifications]
Telegram[Telegram Bot]
end
Core --> Logs
Workers --> Logs
Safety --> Logs
TX --> Logs
Core --> Metrics
Workers --> Metrics
Safety --> Metrics
TX --> Metrics
Logs --> Grafana
Metrics --> Grafana
Metrics --> Alerting
Alerting --> Email
Alerting --> Slack
Alerting --> Telegram
style ON1Builder fill:#f9f9f9,stroke:#333,stroke-width:1px
style Monitoring fill:#f9f9f9,stroke:#333,stroke-width:1px
style Visualization fill:#f9f9f9,stroke:#333,stroke-width:1px
style Notifications fill:#f9f9f9,stroke:#333,stroke-width:1px
style Metrics fill:#bbf,stroke:#333,stroke-width:1px
style Alerting fill:#fbb,stroke:#333,stroke-width:1px
style Grafana fill:#bfb,stroke:#333,stroke-width:1px
ON1Builder provides comprehensive monitoring tools to help you:
ON1Builder writes detailed logs that can be configured in your configuration file:
# Logging configuration
LOG_LEVEL: "INFO" # Options: DEBUG, INFO, WARNING, ERROR
LOG_FORMAT: "detailed" # Options: simple, detailed, json
LOG_TO_FILE: true
LOG_DIR: "data/logs"
Logs are written to the following locations:
data/logs/on1builder.logdata/logs/transactions.logdata/logs/error.logLogs are automatically rotated to prevent disk space issues:
Logs contain structured information including:
Example log entry:
2025-05-21 08:13:21 [INFO] ChainWorker: Initialized chain worker for Ethereum Mainnet (ID: 1)
ON1Builder exposes metrics via Prometheus for real-time monitoring.
sequenceDiagram
participant ON1 as ON1Builder
participant Prom as Prometheus
participant Alert as Alertmanager
participant Grafana as Grafana
participant NotifChannels as Notification Channels
Note over ON1,NotifChannels: Metrics Collection & Visualization Flow
ON1->>ON1: Generate metrics
ON1->>+Prom: Expose metrics endpoint
Prom->>Prom: Scrape metrics
Prom->>Grafana: Provide metrics data
Grafana->>Grafana: Display dashboards
Note over ON1,NotifChannels: Alerting Flow
Prom->>Prom: Evaluate alert rules
Prom->>+Alert: Fire alert
Alert->>Alert: Process alert
Alert->>NotifChannels: Send notifications
Note over ON1,NotifChannels: Custom Threshold Checks
ON1->>ON1: Check custom thresholds
ON1->>NotifChannels: Send direct alerts
In your configuration:
# Prometheus configuration
ENABLE_PROMETHEUS: true
PROMETHEUS_PORT: 9090
PROMETHEUS_PATH: "/metrics"
The following metrics are available:
on1builder_system_memory_usage: Memory usage in byteson1builder_system_cpu_usage: CPU usage percentageon1builder_uptime_seconds: System uptime in secondson1builder_transactions_total: Total number of transactionson1builder_transactions_success: Number of successful transactionson1builder_transactions_failed: Number of failed transactionson1builder_gas_price_gwei: Current gas price in Gweion1builder_profit_total: Total profit in ETHon1builder_gas_spent_total: Total gas spent in ETHon1builder_wallet_balance: Current wallet balance in ETHon1builder_chain_block_number: Latest block number per chainon1builder_chain_transactions: Transactions per chainon1builder_chain_profit: Profit per chainWhen enabled, metrics are available at:
http://your-server:9090/metrics
ON1Builder includes pre-configured Grafana dashboards for visualizing metrics.
flowchart TB
subgraph Dashboards["ON1Builder Dashboards"]
direction LR
Overview["Overview Dashboard"]
ChainDash["Chain Dashboard"]
TxDash["Transaction Dashboard"]
FinancialDash["Financial Dashboard"]
SystemDash["System Dashboard"]
end
subgraph DataSources["Data Sources"]
Prometheus[(Prometheus)]
Logs[(Logs DB)]
end
subgraph Metrics["Key Metrics"]
Performance["Performance Metrics"]
Financial["Financial Metrics"]
Chain["Chain-Specific Metrics"]
System["System Metrics"]
end
DataSources --> Metrics
Metrics --> Dashboards
style Dashboards fill:#f9f9f9,stroke:#333,stroke-width:1px
style DataSources fill:#f9f9f9,stroke:#333,stroke-width:1px
style Metrics fill:#f9f9f9,stroke:#333,stroke-width:1px
style Overview fill:#bbf,stroke:#333,stroke-width:1px
style FinancialDash fill:#bfb,stroke:#333,stroke-width:1px
style TxDash fill:#fbb,stroke:#333,stroke-width:1px
style Prometheus fill:#fbf,stroke:#333,stroke-width:1px
Using Docker:
docker-compose -f docker/compose/docker-compose.prod.yml up -d
ON1Builder includes several dashboards:
Grafana is available at:
http://your-server:3000
Default credentials (if using provided Docker setup):
adminadminON1Builder can send alerts via multiple channels.
flowchart TD
subgraph Events["Alert Events"]
TxEvent["Transaction Event"]
ErrorEvent["Error Event"]
ProfitEvent["Profit Event"]
SystemEvent["System Event"]
end
subgraph Processing["Alert Processing"]
Filter["Alert Filter
(by level & type)"]
Format["Alert Formatter"]
Router["Alert Router"]
end
subgraph Channels["Notification Channels"]
Email["Email Notifications"]
Slack["Slack Channel"]
Telegram["Telegram Bot"]
WebHook["Custom Webhook"]
end
Events --> Filter
Filter --> Format
Format --> Router
Router --> Email
Router --> Slack
Router --> Telegram
Router --> WebHook
style Events fill:#f9f9f9,stroke:#333,stroke-width:1px
style Processing fill:#f9f9f9,stroke:#333,stroke-width:1px
style Channels fill:#f9f9f9,stroke:#333,stroke-width:1px
style ErrorEvent fill:#fbb,stroke:#333,stroke-width:1px
style Format fill:#bfb,stroke:#333,stroke-width:1px
style Router fill:#bbf,stroke:#333,stroke-width:1px
Configure email alerts:
ENABLE_EMAIL_ALERTS: true
ALERT_EMAIL: "alerts@example.com"
SMTP_SERVER: "smtp.example.com"
SMTP_PORT: 587
SMTP_USERNAME: "user@example.com"
SMTP_PASSWORD: "${SMTP_PASSWORD}" # From .env
Configure Slack alerts:
ENABLE_SLACK_ALERTS: true
SLACK_WEBHOOK_URL: "${SLACK_WEBHOOK_URL}" # From .env
SLACK_CHANNEL: "#alerts"
Configure Telegram alerts:
ENABLE_TELEGRAM_ALERTS: true
TELEGRAM_BOT_TOKEN: "${TELEGRAM_BOT_TOKEN}" # From .env
TELEGRAM_CHAT_ID: "${TELEGRAM_CHAT_ID}" # From .env
Alerts are categorized by severity:
Configure which levels trigger alerts:
ALERT_LEVELS: ["ERROR", "CRITICAL"] # Only send ERROR and CRITICAL alerts
Configure which events trigger alerts:
ALERT_ON_TRANSACTION: true # Alert on transactions
ALERT_ON_ERROR: true # Alert on errors
ALERT_ON_PROFIT: true # Alert on profit events
ALERT_ON_SYSTEM: true # Alert on system events
ON1Builder provides health check endpoints for monitoring system health.
In your configuration:
ENABLE_HEALTH_CHECK: true
HEALTH_CHECK_PORT: 8080
HEALTH_CHECK_PATH: "/health"
/health: Overall system health/health/chain/{chain_id}: Health for a specific chain/health/metrics: Basic metrics in JSON format/health/status: Detailed status informationThe health check endpoints are compatible with:
If using a database for persistence:
All transactions are recorded with:
Profit records include:
For production systems, regular database maintenance is recommended:
You can add custom metrics in your code:
from on1builder.monitoring.metrics import metrics
# Creating and updating metrics
metrics.counter("custom_events_total").inc()
metrics.gauge("custom_value").set(42.0)
def execute_custom_strategy():
# Track strategy execution time
with metrics.timer("custom_strategy_execution_time"):
# Strategy implementation
result = perform_strategy()
# Track success/failure
if result.success:
metrics.counter("custom_strategy_success").inc()
else:
metrics.counter("custom_strategy_failure").inc()
# Track profit
metrics.gauge("custom_strategy_profit").set(result.profit)
For production deployments, we recommend:
curl http://localhost:9090/metrics
python -m on1builder test-alert --config your_config.yaml
Now that you understand how to monitor ON1Builder, you might want to: