Claude Code session 1.
This commit is contained in:
@@ -200,11 +200,39 @@ func cacheJanitor(cooldownMinutes int) {
|
||||
|
||||
// ... [rest of the logic remains the same: process, readSource, runPing, etc.]
|
||||
|
||||
// ServiceInfo represents service metadata for discovery
|
||||
type ServiceInfo struct {
|
||||
ServiceType string `json:"service_type"`
|
||||
Version string `json:"version"`
|
||||
Name string `json:"name"`
|
||||
InstanceID string `json:"instance_id"`
|
||||
Capabilities []string `json:"capabilities"`
|
||||
}
|
||||
|
||||
func serviceInfoHandler(w http.ResponseWriter, r *http.Request) {
|
||||
hostname, _ := os.Hostname()
|
||||
if hostname == "" {
|
||||
hostname = "unknown"
|
||||
}
|
||||
|
||||
info := ServiceInfo{
|
||||
ServiceType: "ping",
|
||||
Version: VERSION,
|
||||
Name: "ping_service",
|
||||
InstanceID: hostname,
|
||||
Capabilities: []string{"ping", "traceroute"},
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(info)
|
||||
}
|
||||
|
||||
func startHealthCheckServer(port int) {
|
||||
http.HandleFunc("/health", healthCheckHandler)
|
||||
http.HandleFunc("/service-info", serviceInfoHandler)
|
||||
http.HandleFunc("/ready", readinessHandler)
|
||||
http.HandleFunc("/metrics", metricsHandler)
|
||||
|
||||
|
||||
addr := fmt.Sprintf(":%d", port)
|
||||
log.Printf("Starting health check server on %s", addr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user