Complete the code to import the monitoring library.
from langchain.monitoring import [1]
The Monitor class is used to set up monitoring in LangChain.
Complete the code to create a monitor instance for your LangChain app.
monitor = [1]()You create a monitor instance by calling the Monitor class.
Fix the error in the alert setup code by completing the missing alert type.
monitor.setup_alert(alert_type='[1]', threshold=5)
The webhook alert type allows sending alerts to external services via HTTP requests.
Fill both blanks to create a metric and register it with the monitor.
metric = [1]('request_count', description='Count of requests') monitor.[2](metric)
A Counter tracks counts like requests, and add_metric registers it with the monitor.
Fill all three blanks to create an alert rule for high latency.
alert_rule = {
'[1]': 'latency',
'condition': lambda x: x [2] 1000,
'action': '[3]'
}The alert rule uses 'metric' to specify what to watch, '>' to check if latency is over 1000ms, and 'send_alert' as the action.
