Skip to content

Commit

Permalink
Add monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Kim committed Jul 14, 2023
1 parent 5c8c772 commit 25e8b86
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 4 deletions.
8 changes: 4 additions & 4 deletions langchain/assets/dashboards/overview_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@
"title": "Avg Completion Tokens per Request",
"title_size": "16",
"title_align": "left",
"time": {},
"type": "query_value",
"requests": [
{
Expand Down Expand Up @@ -921,25 +920,26 @@
"value",
"sum"
],
"time": {},
"type": "timeseries",
"requests": [
{
"formulas": [
{
"alias": "Error Rate",
"formula": "(query1 / query2) * 100"
"formula": "(query1 / query2)"
}
],
"queries": [
{
"name": "query1",
"data_source": "metrics",
"query": "sum:langchain.request.error{$env,$service,$version,$provider,$model,$api_key}.as_count()"
"query": "sum:trace.langchain.request.errors{$env,$service,$version,$provider,$model,$api_key}.as_count()"
},
{
"data_source": "metrics",
"name": "query2",
"query": "count:langchain.request.duration{$env,$service,$version,$provider,$model,$api_key}.as_count()"
"query": "sum:trace.langchain.request.hits{$env,$service,$version,$provider,$model,$api_key}.as_count()"
}
],
"response_format": "timeseries",
Expand Down
25 changes: 25 additions & 0 deletions langchain/assets/recommended_monitors/error_rate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "[LangChain] LangChain service has a high error rate",
"type": "query alert",
"query": "sum(last_5m):(sum:trace.langchain.request.errors{*}.as_count() / sum:trace.langchain.request.hits{*}.as_count()) > 0.1",
"message": "{{#is_alert}}\n\nALERT: The error rate of your LangChain requests is higher than normal. The error rate is currently over {{value}} errors per request.\n{{/is_alert}}",
"tags": [
"integration:langchain"
],
"options": {
"thresholds": {
"critical": 0.1,
"warning": 0.05
},
"notify_audit": false,
"require_full_window": false,
"notify_no_data": false,
"renotify_interval": 0,
"include_tags": false
},
"priority": null,
"restricted_roles": null,
"recommended_monitor_metadata": {
"description": "Notify your team when requests made with LangChain have increased error rates"
}
}
24 changes: 24 additions & 0 deletions langchain/assets/recommended_monitors/request_duration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "[LangChain] Request Duration Spike",
"type": "query alert",
"query": "avg(last_5m):avg:system.load.1{*} > 10",
"message": "{{#is_alert}}\n\nALERT: The duration of your LangChain requests is higher than normal. The average LangChain request duration is currently over {{value}} seconds. \n\n{{/is_alert}}",
"tags": [
"integration:langchain"
],
"options": {
"thresholds": {
"critical": 10
},
"notify_audit": false,
"require_full_window": false,
"notify_no_data": false,
"renotify_interval": 0,
"include_tags": false
},
"priority": null,
"restricted_roles": null,
"recommended_monitor_metadata": {
"description": "Notify your team when requests made with LangChain have increased latency"
}
}
4 changes: 4 additions & 0 deletions langchain/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
},
"dashboards": {
"LangChain Overview Dashboard": "assets/dashboards/overview_dashboard.json"
},
"monitors": {
"Request Latency": "assets/recommended_monitors/request_duration.json",
"Error Rate": "assets/recommended_monitors/error_rate.json"
}
},
"author": {
Expand Down

0 comments on commit 25e8b86

Please sign in to comment.