123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497 |
- package service
- import (
- "fmt"
- "go-admin/app/observe/service/dto"
- "go-admin/utils"
- )
- type WeaveScope struct {
- // service.Service
- utils.OtService
- }
- const menuString = `
- [
- {
- "hide_if_empty":false,
- "name":"容器/部署",
- "options":[
- {
- "defaultValue":"application",
- "id":"system",
- "options":[
- {
- "label":"All",
- "value":"all"
- },
- {
- "label":"System containers",
- "value":"system"
- },
- {
- "label":"Application containers",
- "value":"application"
- }
- ]
- },
- {
- "defaultValue":"running",
- "id":"stopped",
- "options":[
- {
- "label":"Stopped containers",
- "value":"stopped"
- },
- {
- "label":"Running containers",
- "value":"running"
- },
- {
- "label":"Both",
- "value":"both"
- }
- ]
- },
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"显示非容器化",
- "value":"show"
- },
- {
- "label":"隐藏非容器化",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":2,
- "stats":{
- "edge_count":22,
- "filtered_nodes":1,
- "node_count":300,
- "nonpseudo_node_count":297
- },
- "sub_topologies":[
- {
- "hide_if_empty":false,
- "name":"by DNS name",
- "options":[
- {
- "defaultValue":"application",
- "id":"system",
- "options":[
- {
- "label":"All",
- "value":"all"
- },
- {
- "label":"System containers",
- "value":"system"
- },
- {
- "label":"Application containers",
- "value":"application"
- }
- ]
- },
- {
- "defaultValue":"running",
- "id":"stopped",
- "options":[
- {
- "label":"Stopped containers",
- "value":"stopped"
- },
- {
- "label":"Running containers",
- "value":"running"
- },
- {
- "label":"Both",
- "value":"both"
- }
- ]
- },
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"Show uncontained",
- "value":"show"
- },
- {
- "label":"Hide uncontained",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":0,
- "stats":{
- "edge_count":20,
- "filtered_nodes":1,
- "node_count":252,
- "nonpseudo_node_count":249
- },
- "url":"/api/topology/containers-by-hostname"
- },
- {
- "hide_if_empty":false,
- "name":"by image",
- "options":[
- {
- "defaultValue":"application",
- "id":"system",
- "options":[
- {
- "label":"All",
- "value":"all"
- },
- {
- "label":"System containers",
- "value":"system"
- },
- {
- "label":"Application containers",
- "value":"application"
- }
- ]
- },
- {
- "defaultValue":"running",
- "id":"stopped",
- "options":[
- {
- "label":"Stopped containers",
- "value":"stopped"
- },
- {
- "label":"Running containers",
- "value":"running"
- },
- {
- "label":"Both",
- "value":"both"
- }
- ]
- },
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"Show uncontained",
- "value":"show"
- },
- {
- "label":"Hide uncontained",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":0,
- "stats":{
- "edge_count":22,
- "filtered_nodes":1,
- "node_count":34,
- "nonpseudo_node_count":31
- },
- "url":"/api/topology/containers-by-image"
- }
- ],
- "url":"/api/topology/containers"
- },
- {
- "hide_if_empty":false,
- "name":"服务拓扑",
- "options":null,
- "rank":4,
- "stats":{
- "edge_count":3,
- "filtered_nodes":0,
- "node_count":3,
- "nonpseudo_node_count":1
- },
- "sub_topologies":[
- {
- "hide_if_empty":false,
- "name":"Weave Net",
- "options":null,
- "rank":0,
- "stats":{
- "edge_count":0,
- "filtered_nodes":0,
- "node_count":1,
- "nonpseudo_node_count":1
- },
- "url":"/api/topology/weave"
- }
- ],
- "url":"/api/v1/ws/topology/services/ws?t=5s&app_alias=%s"
- },
- {
- "hide_if_empty":true,
- "name":"Pods",
- "options":[
- {
- "defaultValue":"hide",
- "id":"snapshot",
- "options":[
- {
- "label":"Show snapshots",
- "value":"show"
- },
- {
- "label":"Hide snapshots",
- "value":"hide"
- }
- ]
- },
- {
- "defaultValue":"hide",
- "id":"storage",
- "options":[
- {
- "label":"Show storage",
- "value":"show"
- },
- {
- "label":"Hide storage",
- "value":"hide"
- }
- ]
- },
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"Show unmanaged",
- "value":"show"
- },
- {
- "label":"Hide unmanaged",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":3,
- "stats":{
- "edge_count":0,
- "filtered_nodes":0,
- "node_count":0,
- "nonpseudo_node_count":0
- },
- "sub_topologies":[
- {
- "hide_if_empty":true,
- "name":"Controllers",
- "options":[
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"Show unmanaged",
- "value":"show"
- },
- {
- "label":"Hide unmanaged",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":0,
- "stats":{
- "edge_count":0,
- "filtered_nodes":0,
- "node_count":0,
- "nonpseudo_node_count":0
- },
- "url":"/api/topology/kube-controllers/%s"
- },
- {
- "hide_if_empty":true,
- "name":"Services",
- "options":[
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"Show unmanaged",
- "value":"show"
- },
- {
- "label":"Hide unmanaged",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":0,
- "stats":{
- "edge_count":0,
- "filtered_nodes":0,
- "node_count":0,
- "nonpseudo_node_count":0
- },
- "url":"/api/topology/services"
- }
- ],
- "url":"/api/topology/pods"
- },
- {
- "hide_if_empty":true,
- "name":"进程",
- "options":[
- {
- "defaultValue":"hide",
- "id":"unconnected",
- "options":[
- {
- "label":"显示未连接",
- "value":"show"
- },
- {
- "label":"隐藏未连接",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":1,
- "stats":{
- "edge_count":24,
- "filtered_nodes":0,
- "node_count":316,
- "nonpseudo_node_count":314
- },
- "url":"/api/topology/processes"
- },
- {
- "hide_if_empty":true,
- "name":"Services",
- "options":[
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"Show unmanaged",
- "value":"show"
- },
- {
- "label":"Hide unmanaged",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":3,
- "stats":{
- "edge_count":0,
- "filtered_nodes":0,
- "node_count":0,
- "nonpseudo_node_count":0
- },
- "url":"/api/topology/swarm-services"
- },
- {
- "hide_if_empty":true,
- "name":"Tasks",
- "options":[
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"Show unmanaged",
- "value":"show"
- },
- {
- "label":"Hide unmanaged",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":3,
- "stats":{
- "edge_count":0,
- "filtered_nodes":0,
- "node_count":0,
- "nonpseudo_node_count":0
- },
- "sub_topologies":[
- {
- "hide_if_empty":true,
- "name":"Services",
- "options":[
- {
- "defaultValue":"hide",
- "id":"pseudo",
- "options":[
- {
- "label":"Show unmanaged",
- "value":"show"
- },
- {
- "label":"Hide unmanaged",
- "value":"hide"
- }
- ]
- }
- ],
- "rank":0,
- "stats":{
- "edge_count":0,
- "filtered_nodes":0,
- "node_count":0,
- "nonpseudo_node_count":0
- },
- "url":"/api/topology/ecs-services"
- }
- ],
- "url":"/api/topology/ecs-tasks"
- }
- ]
- `
- const menuStringServiceOnly = `
- [
- {
- "hide_if_empty":false,
- "name":"服务拓扑",
- "options":null,
- "rank":4,
- "stats":{
- "edge_count":19,
- "filtered_nodes":0,
- "node_count":16,
- "nonpseudo_node_count":16
- },
- "sub_topologies":[],
- "url":"/api/v1/ws/topology/services"
- }
- ]
- `
- // GetPage 获取UrlMapping列表
- func (e *WeaveScope) GetMenu(req *dto.ScopeMenuResp) string {
- return fmt.Sprintf(menuStringServiceOnly) // req.AppAlias, req.Live,
- // req.AppAlias, req.Live,
- }
- //"url":"/api/v1/ws/topology/services/ws?system=application&t=5s&app_alias=%s&start_time=%v&end_time=%v&live=%v"
- // "url":"/api/v1/ss/topology/services/ws?system=application&t=5s&app_alias=%s&live=%v"
|