diff --git a/agent/pkg/controllers/service_map_controller.go b/agent/pkg/controllers/service_map_controller.go index 1824ec022..73b9717bc 100644 --- a/agent/pkg/controllers/service_map_controller.go +++ b/agent/pkg/controllers/service_map_controller.go @@ -1,9 +1,11 @@ package controllers import ( + "mizuserver/pkg/api" "net/http" "github.com/gin-gonic/gin" + "github.com/up9inc/mizu/shared" ) type ServiceMapController struct{} @@ -13,7 +15,14 @@ func NewServiceMapController() *ServiceMapController { } func (s *ServiceMapController) Status(c *gin.Context) { - c.JSON(http.StatusNotImplemented, nil) + serviceMap := api.GetServiceMapInstance() + status := &shared.ServiceMapStatus{ + Status: "enabled", + EntriesProcessedCount: serviceMap.GetEntriesProcessedCount(), + NodeCount: serviceMap.GetNodesCount(), + EdgeCount: serviceMap.GetEdgesCount(), + } + c.JSON(http.StatusOK, status) } func (s *ServiceMapController) Get(c *gin.Context) { diff --git a/shared/models.go b/shared/models.go index abf0c8b67..a25f4221a 100644 --- a/shared/models.go +++ b/shared/models.go @@ -69,6 +69,13 @@ type WebSocketTapConfigMessage struct { TapTargets []v1.Pod `json:"pods"` } +type ServiceMapStatus struct { + Status string `json:"status"` + EntriesProcessedCount int `json:"entriesProcessedCount"` + NodeCount int `json:"nodeCount"` + EdgeCount int `json:"edgeCount"` +} + type TapperStatus struct { TapperName string `json:"tapperName"` NodeName string `json:"nodeName"`