diff --git a/cmd/kubehound/dumper.go b/cmd/kubehound/dumper.go index 458c99d56..72b305a78 100644 --- a/cmd/kubehound/dumper.go +++ b/cmd/kubehound/dumper.go @@ -8,7 +8,6 @@ import ( "github.com/DataDog/KubeHound/pkg/cmd" "github.com/DataDog/KubeHound/pkg/config" "github.com/DataDog/KubeHound/pkg/kubehound/core" - "github.com/DataDog/KubeHound/pkg/telemetry/events" "github.com/DataDog/KubeHound/pkg/telemetry/log" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -45,7 +44,6 @@ var ( // Create a temporary directory tmpDir, err := os.MkdirTemp("", "kubehound") - defer cmd.ReportError(cobraCmd.Context(), events.DumpFinished, err) if err != nil { return fmt.Errorf("create temporary directory: %w", err) } @@ -86,7 +84,6 @@ var ( RunE: func(cobraCmd *cobra.Command, args []string) error { // Passing the Kubehound config from viper khCfg, err := cmd.GetConfig() - defer cmd.ReportError(cobraCmd.Context(), events.DumpFinished, err) if err != nil { return fmt.Errorf("get config: %w", err) } diff --git a/cmd/kubehound/ingest.go b/cmd/kubehound/ingest.go index 3ae5f71cf..fe2423d24 100644 --- a/cmd/kubehound/ingest.go +++ b/cmd/kubehound/ingest.go @@ -6,7 +6,6 @@ import ( "github.com/DataDog/KubeHound/pkg/cmd" "github.com/DataDog/KubeHound/pkg/config" "github.com/DataDog/KubeHound/pkg/kubehound/core" - "github.com/DataDog/KubeHound/pkg/telemetry/events" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -62,7 +61,6 @@ var ( RunE: func(cobraCmd *cobra.Command, args []string) error { // Passing the Kubehound config from viper khCfg, err := cmd.GetConfig() - defer cmd.ReportError(cobraCmd.Context(), events.IngestorFailed, err) if err != nil { return fmt.Errorf("get config: %w", err) } diff --git a/pkg/cmd/util.go b/pkg/cmd/util.go index dd5857b91..6fc11667f 100644 --- a/pkg/cmd/util.go +++ b/pkg/cmd/util.go @@ -6,7 +6,6 @@ import ( "strings" - "github.com/DataDog/KubeHound/pkg/telemetry/events" "github.com/DataDog/KubeHound/pkg/telemetry/log" ) @@ -30,12 +29,3 @@ func AskForConfirmation(ctx context.Context) (bool, error) { return AskForConfirmation(ctx) } } - -func ReportError(ctx context.Context, action events.EventAction, err error) { - l := log.Logger(ctx) - if err != nil { - errMsg := fmt.Errorf("fatal error: %w", err) - l.Error("Error occurred", log.ErrorField(errMsg)) - _ = events.PushEvent(ctx, action, fmt.Sprintf("%s", errMsg)) - } -}