trace: avoid aggregate statistics TX/RX with --all (#4998)
This commit is contained in:
+1
-1
@@ -529,7 +529,7 @@ func mainAdminTrace(ctx *cli.Context) error {
|
||||
traceCh := client.ServiceTrace(ctxt, opts)
|
||||
if stats {
|
||||
filteredTraces := make(chan madmin.ServiceTraceInfo, 1)
|
||||
ui := tea.NewProgram(initTraceStatsUI(ctx.Int("stats-n"), filteredTraces))
|
||||
ui := tea.NewProgram(initTraceStatsUI(ctx.Bool("all"), ctx.Int("stats-n"), filteredTraces))
|
||||
var te error
|
||||
go func() {
|
||||
for t := range traceCh {
|
||||
|
||||
@@ -104,7 +104,7 @@ func mainSupportTopAPI(ctx *cli.Context) error {
|
||||
traceCh := client.ServiceTrace(ctxt, opts)
|
||||
|
||||
filteredTraces := make(chan madmin.ServiceTraceInfo, 1)
|
||||
ui := tea.NewProgram(initTraceStatsUI(30, filteredTraces))
|
||||
ui := tea.NewProgram(initTraceStatsUI(false, 30, filteredTraces))
|
||||
var te error
|
||||
go func() {
|
||||
for t := range traceCh {
|
||||
|
||||
+12
-8
@@ -43,6 +43,7 @@ type traceStatsUI struct {
|
||||
meter spinner.Model
|
||||
quitting bool
|
||||
maxEntries int
|
||||
allFlag bool
|
||||
}
|
||||
|
||||
func (m *traceStatsUI) Init() tea.Cmd {
|
||||
@@ -127,13 +128,15 @@ func (m *traceStatsUI) View() string {
|
||||
}
|
||||
}
|
||||
|
||||
if totalRX > 0 {
|
||||
s.WriteString(console.Colorize("metrics-top-title", fmt.Sprintf("RX Rate:↑ %s/m\n",
|
||||
humanize.IBytes(uint64(float64(totalRX)/dur.Minutes())))))
|
||||
}
|
||||
if totalTX > 0 {
|
||||
s.WriteString(console.Colorize("metrics-top-title", fmt.Sprintf("TX Rate:↓ %s/m\n",
|
||||
humanize.IBytes(uint64(float64(totalTX)/dur.Minutes())))))
|
||||
if !m.allFlag {
|
||||
if totalRX > 0 {
|
||||
s.WriteString(console.Colorize("metrics-top-title", fmt.Sprintf("RX Rate:↑ %s/m\n",
|
||||
humanize.IBytes(uint64(float64(totalRX)/dur.Minutes())))))
|
||||
}
|
||||
if totalTX > 0 {
|
||||
s.WriteString(console.Colorize("metrics-top-title", fmt.Sprintf("TX Rate:↓ %s/m\n",
|
||||
humanize.IBytes(uint64(float64(totalTX)/dur.Minutes())))))
|
||||
}
|
||||
}
|
||||
s.WriteString(console.Colorize("metrics-top-title", fmt.Sprintf("RPM : %0.1f\n", float64(totalCnt)/dur.Minutes())))
|
||||
s.WriteString("-------------\n")
|
||||
@@ -273,7 +276,7 @@ func roundDur(d time.Duration) time.Duration {
|
||||
return d.Round(time.Microsecond)
|
||||
}
|
||||
|
||||
func initTraceStatsUI(maxEntries int, traces <-chan madmin.ServiceTraceInfo) *traceStatsUI {
|
||||
func initTraceStatsUI(allFlag bool, maxEntries int, traces <-chan madmin.ServiceTraceInfo) *traceStatsUI {
|
||||
meter := spinner.New()
|
||||
meter.Spinner = spinner.Meter
|
||||
meter.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205"))
|
||||
@@ -301,5 +304,6 @@ func initTraceStatsUI(maxEntries int, traces <-chan madmin.ServiceTraceInfo) *tr
|
||||
meter: meter,
|
||||
maxEntries: maxEntries,
|
||||
current: stats,
|
||||
allFlag: allFlag,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user