Sync vault notes: April-November 2026 sessions, projects, and architecture
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe4fe656be
commit
994c7ae577
379 files changed
+55216
-107
No files matched your search
@@ -0,0 +1,127 @@
|
||||
# AI Agent Guide — Observability Stack
|
||||
|
||||
This guide is written for coding/operations AI agents working on FetcherPay / SquareMCP.
|
||||
|
||||
---
|
||||
|
||||
## Your job
|
||||
|
||||
Use the observability stack to:
|
||||
1. Verify system health before and after changes.
|
||||
2. Diagnose failures quickly.
|
||||
3. Avoid false alarms by understanding pre-existing issues.
|
||||
4. Document what you find back into this vault.
|
||||
|
||||
---
|
||||
|
||||
## Checklist before making changes
|
||||
|
||||
- [ ] Open the health dashboard: https://dashboard.fetcherpay.com/d/fetcherpay-health-overview
|
||||
- [ ] Confirm no unexpected red panels (ignore known issues in `07-known-issues.md`).
|
||||
- [ ] If touching Hermes, hit `https://hermes.squaremcp.com/health`.
|
||||
- [ ] If touching MySQL, confirm `redis_up` and MySQL `up` are 1.
|
||||
- [ ] If touching ingress, confirm `nginx-ingress-microk8s-controller` is Running.
|
||||
|
||||
---
|
||||
|
||||
## How to query state programmatically
|
||||
|
||||
Use the APIs in `03-api-reference.md`. Preferred pattern:
|
||||
|
||||
```python
|
||||
import json, urllib.request, urllib.error, base64
|
||||
|
||||
GRAFANA_URL = 'https://dashboard.fetcherpay.com'
|
||||
AUTH = base64.b64encode(b'admin:admin_secure_2024').decode()
|
||||
|
||||
def prom_query(uid, q):
|
||||
url = f'{GRAFANA_URL}/api/datasources/proxy/uid/{uid}/api/v1/query?query={urllib.parse.quote(q)}'
|
||||
req = urllib.request.Request(url)
|
||||
req.add_header('Authorization', f'Basic {AUTH}')
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
return json.loads(r.read())
|
||||
|
||||
# Example: are all websites healthy?
|
||||
res = prom_query('ffpaxh13af2f4e', 'avg(probe_success{job="blackbox-http"})')
|
||||
healthy_pct = float(res['data']['result'][0]['value'][1]) * 100
|
||||
print(f'{healthy_pct:.0f}% websites healthy')
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common agent tasks
|
||||
|
||||
### Check if a pod is running
|
||||
|
||||
```bash
|
||||
microk8s kubectl get pods -n <namespace> -l app=<app>
|
||||
```
|
||||
|
||||
If direct `logs`/`exec` fails with TLS error, use:
|
||||
|
||||
```bash
|
||||
microk8s kubectl logs -n <namespace> -l app=<app> --insecure-skip-tls-verify-backend=true --tail=50
|
||||
```
|
||||
|
||||
Or use `kubectl proxy` for HTTP health endpoints:
|
||||
|
||||
```bash
|
||||
microk8s kubectl proxy --port=8000 &
|
||||
curl http://localhost:8000/api/v1/namespaces/<ns>/services/<svc>:<port>/proxy/<path>
|
||||
```
|
||||
|
||||
### Add a new website to the health dashboard
|
||||
|
||||
1. Edit `hermes-mcp/monitoring/prometheus-config.yaml`.
|
||||
2. Add URL to `blackbox-http` targets.
|
||||
3. Commit, push, apply.
|
||||
4. Restart Prometheus.
|
||||
5. Verify with `probe_success{instance="https://new-site.com"}`.
|
||||
|
||||
### Add a new metric panel to a dashboard
|
||||
|
||||
1. Get the dashboard JSON via `/api/dashboards/uid/<uid>`.
|
||||
2. Add a panel object with a PromQL target.
|
||||
3. POST back to `/api/dashboards/db` with `overwrite: true`.
|
||||
4. Test the query first via the Prometheus query API.
|
||||
|
||||
### Investigate an alert
|
||||
|
||||
1. Read the alert labels (severity, instance, job).
|
||||
2. Look up the matching PromQL in `04-alerts-and-response.md`.
|
||||
3. Query the metric directly.
|
||||
4. Check pod status and logs.
|
||||
5. Fix or silence, then document the outcome in this vault.
|
||||
|
||||
---
|
||||
|
||||
## What NOT to do
|
||||
|
||||
- **Do not** restart the ingress controller unless it is actually failing requests.
|
||||
- **Do not** delete the `fetcherpay-leads-*` pods expecting them to fix themselves — they have stale image refs.
|
||||
- **Do not** run `docker system prune` without checking if MySQL or MT5 containers are running.
|
||||
- **Do not** leave `kubectl proxy` background processes running indefinitely.
|
||||
- **Do not** change `monitoring/alertmanager-config.yaml` without testing SMTP/Slack delivery.
|
||||
|
||||
---
|
||||
|
||||
## Decision tree
|
||||
|
||||
```
|
||||
User asks "Is X down?"
|
||||
│
|
||||
├─ Check health dashboard first
|
||||
├─ If red, query probe_success / up metric
|
||||
├─ If pod-related, check kubectl get pods / logs
|
||||
├─ If known issue (leads, nginx restarts), explain root cause
|
||||
└─ Update this vault if the failure is new or unresolved
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Vault update discipline
|
||||
|
||||
After every significant investigation or change:
|
||||
1. Update the relevant runbook file.
|
||||
2. If it is a deployment, also add/update `SquareMCP/deployments/YYYY-MM-DD-*.md`.
|
||||
3. Cross-link from `00-index.md` if a new topic is introduced.
|
||||
Reference in new issue
Block a user