MCPcopy Create free account
hub / github.com/compozy/agh / networkStatusBundle

Function networkStatusBundle

internal/cli/network.go:1115–1182  ·  view source on GitHub ↗
(status NetworkStatusRecord)

Source from the content-addressed store, hash-verified

1113}
1114
1115func networkStatusBundle(status NetworkStatusRecord) outputBundle {
1116 rows := []keyValue{
1117 {Label: networkEnabledValue, Value: strconv.FormatBool(status.Enabled)},
1118 {Label: networkStatusValue, Value: stringOrDash(status.Status)},
1119 {Label: "Listener", Value: stringOrDash(networkListener(&status))},
1120 {Label: "Local Peers", Value: strconv.Itoa(status.LocalPeers)},
1121 {Label: "Remote Peers", Value: strconv.Itoa(status.RemotePeers)},
1122 {Label: "Channels", Value: strconv.Itoa(status.Channels)},
1123 {Label: "Queued Messages", Value: strconv.Itoa(status.QueuedMessages)},
1124 {Label: "Queued Sessions", Value: strconv.Itoa(status.QueuedSessions)},
1125 {Label: "Delivery Workers", Value: strconv.Itoa(status.DeliveryWorkers)},
1126 {Label: "Messages Sent", Value: strconv.FormatInt(status.MessagesSent, 10)},
1127 {Label: "Messages Received", Value: strconv.FormatInt(status.MessagesReceived, 10)},
1128 {Label: "Messages Rejected", Value: strconv.FormatInt(status.MessagesRejected, 10)},
1129 {Label: "Messages Delivered", Value: strconv.FormatInt(status.MessagesDelivered, 10)},
1130 {Label: "Workflow Tagged", Value: strconv.FormatInt(status.WorkflowTaggedEvents, 10)},
1131 {Label: "Handoff Tagged", Value: strconv.FormatInt(status.HandoffTaggedEvents, 10)},
1132 {Label: "Last Disconnect", Value: stringOrDash(status.LastDisconnect)},
1133 }
1134 fields := []string{
1135 networkEnabledKey, networkStatusKey, "listener", "local_peers", "remote_peers", networkChannelsKey,
1136 "queued_messages", "queued_sessions", "delivery_workers", "messages_sent",
1137 "messages_received", "messages_rejected", "messages_delivered",
1138 "workflow_tagged_events", "handoff_tagged_events", "last_disconnect",
1139 }
1140 values := []string{
1141 strconv.FormatBool(status.Enabled),
1142 status.Status,
1143 networkListener(&status),
1144 strconv.Itoa(status.LocalPeers),
1145 strconv.Itoa(status.RemotePeers),
1146 strconv.Itoa(status.Channels),
1147 strconv.Itoa(status.QueuedMessages),
1148 strconv.Itoa(status.QueuedSessions),
1149 strconv.Itoa(status.DeliveryWorkers),
1150 strconv.FormatInt(status.MessagesSent, 10),
1151 strconv.FormatInt(status.MessagesReceived, 10),
1152 strconv.FormatInt(status.MessagesRejected, 10),
1153 strconv.FormatInt(status.MessagesDelivered, 10),
1154 strconv.FormatInt(status.WorkflowTaggedEvents, 10),
1155 strconv.FormatInt(status.HandoffTaggedEvents, 10),
1156 status.LastDisconnect,
1157 }
1158
1159 return outputBundle{
1160 jsonValue: status,
1161 human: func() (string, error) {
1162 return renderHumanBlocks(
1163 renderHumanSection("Network", rows),
1164 renderHumanTable(
1165 "Kind Metrics",
1166 []string{networkKindValue, "Sent", "Received", "Rejected", "Delivered"},
1167 networkKindMetricRows(status.KindMetrics),
1168 ),
1169 ), nil
1170 },
1171 toon: func() (string, error) {
1172 return renderHumanBlocks(

Callers 1

newNetworkStatusCommandFunction · 0.85

Calls 8

stringOrDashFunction · 0.85
networkListenerFunction · 0.85
renderHumanBlocksFunction · 0.85
renderHumanSectionFunction · 0.85
renderHumanTableFunction · 0.85
networkKindMetricRowsFunction · 0.85
renderToonObjectFunction · 0.85
renderToonArrayFunction · 0.85

Tested by

no test coverage detected