Add debug logging for interval values in monitor creation
All checks were successful
Build and Push Container / build (push) Successful in 34s
All checks were successful
Build and Push Container / build (push) Successful in 34s
This helps trace the interval values at each step: - Claude agent logs what interval it suggested - Monitor service logs the interval when creating and deploying 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
@@ -6,6 +7,8 @@ from anthropic import Anthropic
|
|||||||
|
|
||||||
from config import get_config
|
from config import get_config
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
SYSTEM_PROMPT = """You are an intelligent monitoring configuration assistant for Uptime Kuma. Your role is to analyze system information from hosts and recommend what should be monitored.
|
SYSTEM_PROMPT = """You are an intelligent monitoring configuration assistant for Uptime Kuma. Your role is to analyze system information from hosts and recommend what should be monitored.
|
||||||
|
|
||||||
@@ -270,6 +273,13 @@ Respond with JSON as specified in your instructions."""
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Log what Claude suggested
|
||||||
|
for mon in monitors:
|
||||||
|
logger.info(
|
||||||
|
f"Claude suggested monitor: {mon.name}, type={mon.type}, "
|
||||||
|
f"interval={mon.interval}s, push_metric={mon.push_metric}"
|
||||||
|
)
|
||||||
|
|
||||||
commands = []
|
commands = []
|
||||||
for c in data.get("additional_commands", []):
|
for c in data.get("additional_commands", []):
|
||||||
commands.append(
|
commands.append(
|
||||||
|
|||||||
@@ -167,6 +167,12 @@ class MonitorService:
|
|||||||
"""
|
"""
|
||||||
kuma = get_kuma_client()
|
kuma = get_kuma_client()
|
||||||
|
|
||||||
|
interval_minutes = max(1, suggestion.interval // 60)
|
||||||
|
logger.info(
|
||||||
|
f"Creating monitor '{suggestion.name}': type={suggestion.type}, "
|
||||||
|
f"interval={suggestion.interval}s ({interval_minutes}min)"
|
||||||
|
)
|
||||||
|
|
||||||
# Build monitor from suggestion
|
# Build monitor from suggestion
|
||||||
monitor = Monitor(
|
monitor = Monitor(
|
||||||
type=suggestion.type,
|
type=suggestion.type,
|
||||||
@@ -259,6 +265,11 @@ class MonitorService:
|
|||||||
Returns:
|
Returns:
|
||||||
Dict with status and any error messages
|
Dict with status and any error messages
|
||||||
"""
|
"""
|
||||||
|
logger.info(
|
||||||
|
f"Deploying push script: metric={push_metric}, monitor_id={monitor_id}, "
|
||||||
|
f"interval_minutes={interval_minutes}"
|
||||||
|
)
|
||||||
|
|
||||||
kuma = get_kuma_client()
|
kuma = get_kuma_client()
|
||||||
ssh = get_ssh_manager()
|
ssh = get_ssh_manager()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user