mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-17 07:16:09 +00:00
implementing the status endpoint
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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"`
|
||||
|
Reference in New Issue
Block a user