mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-09-03 00:47:17 +00:00
feat(host-collector): add progress for host collector (#1659)
This commit is contained in:
@@ -227,14 +227,16 @@ func collectRemoteHost(ctx context.Context, collectSpecs []*troubleshootv1beta2.
|
||||
|
||||
isExcluded, _ := collector.IsExcluded()
|
||||
if isExcluded {
|
||||
opts.ProgressChan <- fmt.Sprintf("[%s] Excluding host collector", collector.Title())
|
||||
msg := fmt.Sprintf("[%s] Excluding host collector", collector.Title())
|
||||
opts.CollectorProgressCallback(opts.ProgressChan, msg)
|
||||
span.SetAttributes(attribute.Bool(constants.EXCLUDED, true))
|
||||
span.End()
|
||||
continue
|
||||
}
|
||||
|
||||
// Send progress event: starting the collector
|
||||
opts.ProgressChan <- fmt.Sprintf("[%s] Running host collector...", collector.Title())
|
||||
msg := fmt.Sprintf("[%s] Running host collector...", collector.Title())
|
||||
opts.CollectorProgressCallback(opts.ProgressChan, msg)
|
||||
|
||||
// Parameters for remote collection
|
||||
params := &collect.RemoteCollectParams{
|
||||
@@ -255,12 +257,14 @@ func collectRemoteHost(ctx context.Context, collectSpecs []*troubleshootv1beta2.
|
||||
result, err := collect.RemoteHostCollect(ctx, *params)
|
||||
if err != nil {
|
||||
span.SetStatus(codes.Error, err.Error())
|
||||
opts.ProgressChan <- fmt.Sprintf("[%s] Error: %v", collector.Title(), err)
|
||||
msg = fmt.Sprintf("[%s] Error: %v", collector.Title(), err)
|
||||
opts.CollectorProgressCallback(opts.ProgressChan, msg)
|
||||
return errors.Wrap(err, "failed to run remote host collector")
|
||||
}
|
||||
|
||||
// Send progress event: completed successfully
|
||||
opts.ProgressChan <- fmt.Sprintf("[%s] Completed host collector", collector.Title())
|
||||
msg = fmt.Sprintf("[%s] Completed host collector", collector.Title())
|
||||
opts.CollectorProgressCallback(opts.ProgressChan, msg)
|
||||
|
||||
// Aggregate the results
|
||||
for k, v := range result {
|
||||
|
||||
Reference in New Issue
Block a user