Skip to content

Commit

Permalink
Merge 87fd068 into ae82d18
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy authored Jan 20, 2023
2 parents ae82d18 + 87fd068 commit 2713986
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions pkg/odo/genericclioptions/runnable.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ func GenericRun(o Runnable, cmd *cobra.Command, args []string) error {
// set value for telemetry status in context so that we do not need to call IsTelemetryEnabled every time to check its status
scontext.SetTelemetryStatus(cmd.Context(), segment.IsTelemetryEnabled(userConfig, envConfig))

scontext.SetExperimentalMode(cmd.Context(), envConfig.OdoExperimentalMode)

// Send data to telemetry in case of user interrupt
captureSignals := []os.Signal{syscall.SIGHUP, syscall.SIGTERM, syscall.SIGQUIT, os.Interrupt}
go commonutil.StartSignalWatcher(captureSignals, func(receivedSignal os.Signal) {
Expand Down
25 changes: 15 additions & 10 deletions pkg/segment/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ import (
)

const (
Caller = "caller"
ComponentType = "componentType"
ClusterType = "clusterType"
TelemetryStatus = "isTelemetryEnabled"
DevfileName = "devfileName"
Language = "language"
ProjectType = "projectType"
NOTFOUND = "not-found"
InteractiveMode = "interactive"
Flags = "flags"
Caller = "caller"
ComponentType = "componentType"
ClusterType = "clusterType"
TelemetryStatus = "isTelemetryEnabled"
DevfileName = "devfileName"
Language = "language"
ProjectType = "projectType"
NOTFOUND = "not-found"
InteractiveMode = "interactive"
ExperimentalMode = "experimental"
Flags = "flags"
)

const (
Expand Down Expand Up @@ -122,6 +123,10 @@ func SetInteractive(ctx context.Context, interactive bool) {
setContextProperty(ctx, InteractiveMode, interactive)
}

func SetExperimentalMode(ctx context.Context, value bool) {
setContextProperty(ctx, ExperimentalMode, value)
}

// SetFlags sets flags property for telemetry to record what flags were used
func SetFlags(ctx context.Context, flags *pflag.FlagSet) {
var changedFlags []string
Expand Down

0 comments on commit 2713986

Please sign in to comment.