Update go deps (major) (#3179)
* Update go deps Generated by renovateBot * update api usage --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: David Zhao <dz@livekit.io>
This commit is contained in:
co-authored by
David Zhao
parent
d6aef547ce
commit
97378368dd
+26
-17
@@ -24,6 +24,7 @@ import (
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/olekukonko/tablewriter/tw"
|
||||
"github.com/urfave/cli/v3"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
@@ -187,10 +188,27 @@ func listNodes(_ context.Context, c *cli.Command) error {
|
||||
return err
|
||||
}
|
||||
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
table.SetRowLine(true)
|
||||
table.SetAutoWrapText(false)
|
||||
table.SetHeader([]string{
|
||||
table := tablewriter.NewTable(os.Stdout,
|
||||
tablewriter.WithHeaderAutoFormat(tw.Off),
|
||||
tablewriter.WithRowAutoWrap(0),
|
||||
tablewriter.WithRendition(tw.Rendition{
|
||||
Settings: tw.Settings{
|
||||
Separators: tw.Separators{BetweenRows: tw.On},
|
||||
},
|
||||
}),
|
||||
tablewriter.WithRowAlignmentConfig(tw.CellAlignment{
|
||||
PerColumn: []tw.Align{
|
||||
tw.AlignCenter, tw.AlignCenter, tw.AlignCenter,
|
||||
tw.AlignRight, tw.AlignRight,
|
||||
tw.AlignRight,
|
||||
tw.AlignRight, tw.AlignRight,
|
||||
tw.AlignRight, tw.AlignRight, tw.AlignRight,
|
||||
tw.AlignRight, tw.AlignRight,
|
||||
tw.AlignCenter,
|
||||
},
|
||||
}),
|
||||
)
|
||||
table.Header(
|
||||
"ID", "IP Address", "Region",
|
||||
"CPUs", "CPU Usage\nLoad Avg",
|
||||
"Memory Used/Total",
|
||||
@@ -198,16 +216,7 @@ func listNodes(_ context.Context, c *cli.Command) error {
|
||||
"Bytes/s In/Out\nBytes Total", "Packets/s In/Out\nPackets Total", "System Dropped Pkts/s\nPkts/s Out/Dropped",
|
||||
"Nack/s\nNack Total", "Retrans/s\nRetrans Total",
|
||||
"Started At\nUpdated At",
|
||||
})
|
||||
table.SetColumnAlignment([]int{
|
||||
tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER, tablewriter.ALIGN_CENTER,
|
||||
tablewriter.ALIGN_RIGHT, tablewriter.ALIGN_RIGHT,
|
||||
tablewriter.ALIGN_RIGHT,
|
||||
tablewriter.ALIGN_RIGHT, tablewriter.ALIGN_RIGHT,
|
||||
tablewriter.ALIGN_RIGHT, tablewriter.ALIGN_RIGHT, tablewriter.ALIGN_RIGHT,
|
||||
tablewriter.ALIGN_RIGHT, tablewriter.ALIGN_RIGHT,
|
||||
tablewriter.ALIGN_CENTER,
|
||||
})
|
||||
)
|
||||
|
||||
for _, node := range nodes {
|
||||
stats := node.Stats
|
||||
@@ -246,7 +255,7 @@ func listNodes(_ context.Context, c *cli.Command) error {
|
||||
startedAndUpdated := fmt.Sprintf("%s\n%s", time.Unix(stats.StartedAt, 0).UTC().UTC().Format("2006-01-02 15:04:05"),
|
||||
time.Unix(stats.UpdatedAt, 0).UTC().Format("2006-01-02 15:04:05"))
|
||||
|
||||
table.Append([]string{
|
||||
table.Append(
|
||||
idAndState, node.Ip, node.Region,
|
||||
cpus, cpuUsageAndLoadAvg,
|
||||
memUsage,
|
||||
@@ -254,9 +263,9 @@ func listNodes(_ context.Context, c *cli.Command) error {
|
||||
bytes, packets, sysPackets,
|
||||
nacks, retransmit,
|
||||
startedAndUpdated,
|
||||
})
|
||||
)
|
||||
}
|
||||
table.Render()
|
||||
table.Render() //nolint:errcheck
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user