-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update grafana and promtail default config
- Loading branch information
1 parent
8f0f3d2
commit 59cc85a
Showing
4 changed files
with
118 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
groups: | ||
- name: log-rules | ||
- name: grid_trading_alerts | ||
rules: | ||
- alert: HighErrorRate | ||
- alert: HighCPUUsage | ||
expr: | | ||
sum(rate({job="grid_trading_bot", level="error"}[5m])) > 0.01 | ||
avg_over_time({job="grid_trading_bot"} | json | unwrap cpu [5m]) > 80 | ||
for: 2m | ||
labels: | ||
severity: warning | ||
annotations: | ||
summary: High CPU usage detected | ||
|
||
- alert: OrderExecutionFailure | ||
expr: | | ||
count_over_time({job="grid_trading_bot"} |= "Failed to execute order" [5m]) > 3 | ||
for: 1m | ||
labels: | ||
severity: critical | ||
annotations: | ||
description: High error rate detected in logs for job {{ $labels.job }} is above 0.01. | ||
summary: High error rate detected in logs | ||
summary: Multiple order execution failures detected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,103 @@ | ||
{ | ||
"id": null, | ||
"uid": "grid_trading_bot_dashboard", | ||
"title": "Grid Trading Bot Monitoring", | ||
"tags": ["grid_trading_bot", "monitoring"], | ||
"timezone": "browser", | ||
"schemaVersion": 36, | ||
"version": 1, | ||
"refresh": "30s", | ||
"panels": [ | ||
"title": "Grid Trading Bot Dashboard", | ||
"variables": [ | ||
{ | ||
"id": 1, | ||
"type": "stat", | ||
"title": "Bot Uptime", | ||
"name": "trading_pair", | ||
"type": "query", | ||
"datasource": "Loki", | ||
"targets": [ | ||
{ | ||
"expr": "{job=\"grid_trading_bot\"} |= \"Bot started successfully\"", | ||
"legendFormat": "Uptime", | ||
"refId": "A" | ||
} | ||
], | ||
"gridPos": { "x": 0, "y": 0, "w": 4, "h": 3 } | ||
"query": "label_values(trading_pair)" | ||
}, | ||
{ | ||
"id": 2, | ||
"type": "logs", | ||
"title": "Error Logs", | ||
"name": "trading_mode", | ||
"type": "query", | ||
"datasource": "Loki", | ||
"query": "label_values(trading_mode)" | ||
}, | ||
{ | ||
"name": "strategy", | ||
"type": "query", | ||
"datasource": "Loki", | ||
"query": "label_values(strategy_type)" | ||
} | ||
], | ||
"panels": [ | ||
{ | ||
"title": "Strategy Overview", | ||
"type": "stat", | ||
"datasource": "Loki", | ||
"targets": [ | ||
{ | ||
"expr": "{job=\"grid_trading_bot\"} |= \"ERROR\"", | ||
"refId": "A" | ||
"expr": "{job=\"grid_trading_bot\", trading_pair=\"$trading_pair\", trading_mode=\"$trading_mode\", strategy_type=\"$strategy\"} | json | line_format \"{{.grid_size}} grids, Range: {{.grid_range}}, Spacing: {{.spacing_type}}\"" | ||
} | ||
], | ||
"gridPos": { "x": 4, "y": 0, "w": 8, "h": 6 } | ||
] | ||
}, | ||
{ | ||
"id": 3, | ||
"title": "ROI Over Time", | ||
"type": "timeseries", | ||
"title": "Total Account Value", | ||
"datasource": "Loki", | ||
"targets": [ | ||
{ | ||
"expr": "{job=\"grid_trading_bot\"} |= \"Account value\" | json | __value__=Account value", | ||
"refId": "A" | ||
"expr": "{job=\"grid_trading_bot\", trading_pair=\"$trading_pair\", trading_mode=\"$trading_mode\", strategy_type=\"$strategy\"} | regexp \"ROI\\s+\\|\\s+(?P<roi>[\\-\\d\\.]+)%\" | unwrap roi" | ||
} | ||
], | ||
"gridPos": { "x": 0, "y": 3, "w": 12, "h": 6 } | ||
] | ||
}, | ||
{ | ||
"id": 4, | ||
"type": "piechart", | ||
"title": "Orders by Status", | ||
"title": "Grid Level States", | ||
"type": "table", | ||
"datasource": "Loki", | ||
"targets": [ | ||
{ | ||
"expr": "{job=\"grid_trading_bot\"} |= \"Order status\" | json | order_status", | ||
"refId": "A" | ||
"expr": "{job=\"grid_trading_bot\", trading_pair=\"$trading_pair\", trading_mode=\"$trading_mode\", strategy_type=\"$strategy\"} | json | grid_price != \"\" and grid_state != \"\" | line_format \"{{.grid_price}} - {{.grid_state}}\"" | ||
} | ||
], | ||
"gridPos": { "x": 12, "y": 0, "w": 6, "h": 6 } | ||
] | ||
}, | ||
{ | ||
"id": 5, | ||
"title": "Order Flow", | ||
"type": "timeseries", | ||
"title": "Error Count Over Time", | ||
"datasource": "Loki", | ||
"targets": [ | ||
{ | ||
"expr": "count_over_time({job=\"grid_trading_bot\"} |= \"ERROR\" [1m])", | ||
"refId": "A" | ||
"expr": "sum(count_over_time({job=\"grid_trading_bot\", trading_pair=\"$trading_pair\", trading_mode=\"$trading_mode\", strategy_type=\"$strategy\", order_side=\"BUY\"}[5m]))", | ||
"legendFormat": "Buy Orders" | ||
}, | ||
{ | ||
"expr": "sum(count_over_time({job=\"grid_trading_bot\", trading_pair=\"$trading_pair\", trading_mode=\"$trading_mode\", strategy_type=\"$strategy\", order_side=\"SELL\"}[5m]))", | ||
"legendFormat": "Sell Orders" | ||
} | ||
], | ||
"gridPos": { "x": 12, "y": 6, "w": 6, "h": 6 } | ||
] | ||
}, | ||
{ | ||
"id": 6, | ||
"type": "logs", | ||
"title": "Completed Orders", | ||
"title": "Balance History", | ||
"type": "timeseries", | ||
"datasource": "Loki", | ||
"targets": [ | ||
{ | ||
"expr": "{job=\"grid_trading_bot\"} |= \"Order status: FILLED\"", | ||
"refId": "A" | ||
"expr": "{job=\"grid_trading_bot\", trading_pair=\"$trading_pair\", trading_mode=\"$trading_mode\", strategy_type=\"$strategy\"} | regexp \"Balance: (?P<balance>[\\d\\.]+)\" | unwrap balance" | ||
} | ||
], | ||
"gridPos": { "x": 0, "y": 9, "w": 12, "h": 6 } | ||
] | ||
}, | ||
{ | ||
"id": 7, | ||
"type": "logs", | ||
"title": "Open Orders", | ||
"title": "System Health", | ||
"type": "gauge", | ||
"datasource": "Loki", | ||
"targets": [ | ||
{ | ||
"expr": "{job=\"grid_trading_bot\"} |= \"Order status: OPEN\"", | ||
"refId": "A" | ||
"expr": "{job=\"grid_trading_bot\", trading_pair=\"$trading_pair\"} | json | unwrap cpu" | ||
} | ||
], | ||
"gridPos": { "x": 12, "y": 9, "w": 12, "h": 6 } | ||
"fieldConfig": { | ||
"defaults": { | ||
"thresholds": { | ||
"steps": [ | ||
{ "value": 0, "color": "green" }, | ||
{ "value": 70, "color": "yellow" }, | ||
{ "value": 85, "color": "red" } | ||
] | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"templating": { | ||
"list": [] | ||
}, | ||
"time": { | ||
"from": "now-24h", | ||
"to": "now" | ||
}, | ||
"timepicker": {}, | ||
"annotations": { | ||
"list": [] | ||
}, | ||
"variables": { | ||
"list": [] | ||
} | ||
"refresh": "10s", | ||
"schemaVersion": 36 | ||
} |