Skip to content

Commit b35e20e

Browse files
authored
show flame and telemetry duration in status (#98)
1 parent 9cd364a commit b35e20e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

internal/common/common.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func (rc *ReportingCommand) Run() error {
187187
channelTargetScriptOutputs := make(chan TargetScriptOutputs)
188188
channelError := make(chan error)
189189
for _, target := range myTargets {
190-
go collectOnTarget(rc.Cmd, target, scriptsToRun, localTempDir, channelTargetScriptOutputs, channelError, multiSpinner.Status)
190+
go collectOnTarget(rc.Cmd, rc.Duration, target, scriptsToRun, localTempDir, channelTargetScriptOutputs, channelError, multiSpinner.Status)
191191
}
192192
// wait for scripts to run on all targets
193193
var allTargetScriptOutputs []TargetScriptOutputs
@@ -382,7 +382,7 @@ func DefaultInsightsFunc(allTableValues []report.TableValues, scriptOutputs map[
382382
return insightsTableValues
383383
}
384384

385-
func collectOnTarget(cmd *cobra.Command, myTarget target.Target, scriptsToRun []script.ScriptDefinition, localTempDir string, channelTargetScriptOutputs chan TargetScriptOutputs, channelError chan error, statusUpdate progress.MultiSpinnerUpdateFunc) {
385+
func collectOnTarget(cmd *cobra.Command, duration int, myTarget target.Target, scriptsToRun []script.ScriptDefinition, localTempDir string, channelTargetScriptOutputs chan TargetScriptOutputs, channelError chan error, statusUpdate progress.MultiSpinnerUpdateFunc) {
386386
// create a temporary directory on the target
387387
var targetTempDir string
388388
var err error
@@ -404,7 +404,11 @@ func collectOnTarget(cmd *cobra.Command, myTarget target.Target, scriptsToRun []
404404
}()
405405
}
406406
// run the scripts on the target
407-
_ = statusUpdate(myTarget.GetName(), "collecting data")
407+
status := "collecting data"
408+
if duration > 0 {
409+
status = fmt.Sprintf("%s, duration=%ds", status, duration)
410+
}
411+
_ = statusUpdate(myTarget.GetName(), status)
408412
scriptOutputs, err := script.RunScripts(myTarget, scriptsToRun, true, localTempDir)
409413
if err != nil {
410414
_ = statusUpdate(myTarget.GetName(), fmt.Sprintf("error collecting data: %v", err))

0 commit comments

Comments
 (0)