Collect Component type for usage data (#4662)

* Add support for componentType to telemetry and replace Execute with ExecuteContext to support context

* Make o.Run() compatible with ExecuteContext

* Add unit tests for upload with context

* Fix ci unit test failure

* Move context code to a separate package within the segment package

* separate private and public methods, reorganize

* fix import
This commit is contained in:
Parthvi Vala
2021-05-20 11:01:57 +05:30
committed by GitHub
parent 4891fc4494
commit 322b6d2ec4
66 changed files with 263 additions and 90 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"context"
"flag"
"os"
@@ -10,6 +11,7 @@ import (
"github.com/openshift/odo/pkg/odo/util"
"github.com/openshift/odo/pkg/odo/util/completion"
"github.com/openshift/odo/pkg/preference"
segment "github.com/openshift/odo/pkg/segment/context"
"github.com/posener/complete"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@@ -65,7 +67,7 @@ func main() {
updateInfo := make(chan string)
go version.GetLatestReleaseInfo(updateInfo)
util.LogErrorAndExit(root.Execute(), "")
util.LogErrorAndExit(root.ExecuteContext(segment.NewContext(context.Background())), "")
select {
case message := <-updateInfo:
log.Italic(message)
@@ -73,7 +75,7 @@ func main() {
klog.V(4).Info("Could not get the latest release information in time. Never mind, exiting gracefully :)")
}
} else {
util.LogErrorAndExit(root.Execute(), "")
util.LogErrorAndExit(root.ExecuteContext(segment.NewContext(context.Background())), "")
}
}