Lesson 28: Monitoring Bot Performance (Uptime, Gas Usage & Health Checks)
So by now you have built bots, deployed them, routed their alerts, but... what if they stop working? What if they miss alerts? Or burn too much gas?
This is where observability becomes a key part of your workflow.
Just like any DevOps engineer tracks app uptime, error rates, and resource usage…
As a Forta Administrator, you must monitor your bots too.
This lesson shows you how to track and optimize your detection bot’s performance.
Why Bot Observability in important
If a bot is silent, that doesn’t mean everything’s fine.
It could be:
Crashing
Failing to match txs
Running out of RPC quota
Not syncing with the chain
Stuck in an old deployment
And that’s a false sense of security.
Forta’s Built-In Bot Metrics
Forta automatically tracks many stats per agent and chain.
Go to: https://explorer.forta.network
Click on a bot --> Performance Tab
You’ll see:
Uptime %: is the bot consistently running?
Alert rate: are alerts being triggered as expected?
Average run time: how long each
handleTransaction
takesGas estimation: simulated gas per tx
Error logs: Crashes, RPC failures, etc.
Monitoring Metrics in Detail
1. Uptime
Goal: Keep above 99%
Low uptime? Then investigate:
Crashes
CI/CD issues
Memory leaks
2. Alert Frequency
Too few alerts? Then bot logic may be broken.
Too many? Then bot may be too sensitive (false positives).
You want:
Predictable rate
Based on historic pattern
Tuned thresholds
3. Runtime Duration
Each tx analysis should take under 1 second ideally.
Long runtimes mean more gas and higher chance of timeouts.
Optimize:
Cache external calls
Avoid complex loops
Preprocess tx data
4. Gas Simulation
Forta simulates gas usage based on EVM replay.
Too high? Then your bot may:
Make external calls
Process too many logs
Have excessive token decoding
Keep it light.
5. Chain-Specific Differences
Bots may behave differently across chains:
Tools to Monitor Bots
Forta Explorer: UI for metrics
Forta API: pull metrics into dashboards
Self-Check Bot: build an agent that regularly confirms it’s running.
Prometheus + Grafana: for advanced monitoring
Suggestion
Build a Slack bot that posts when:
Alerts fall below expected level
Bot uptime drops
Gas exceeds budget
Use GitHub Actions to auto-check health after deployment
Write unit tests to detect “silent failure” cases
Key Concepts Recap
Forta provides built-in metrics for uptime, alerts, gas, and errors
You must actively monitor bots and don’t assume they work
Keep bots lean, fast and predictable
Set up custom alerts to monitor bot performance issues.
Observability is part of blockchain DevSecOps
Next lesson we will explore bot orchestration and CI/CD, making your agents deploy themselves.
🙏 Until next meditation,
The Blockchain Security Monk