From 4aedcba071c2b87a896c7201bd137fe946840168 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Thu, 7 Nov 2024 14:03:05 +0100 Subject: [PATCH] Remove cloud commands, make sure segment doesn't spam logs with errors (#1477) --- .github/workflows/branch-build.yml | 4 +- .github/workflows/pr-build.yaml | 4 +- .github/workflows/prod-e2e-test.yml | 49 ------ cmd/cli/cmd/login.go | 37 ----- cmd/cli/cmd/migrate.go | 142 ----------------- cmd/cli/cmd/root.go | 7 - cmd/cli/docs/botkube.md | 7 - cmd/cli/docs/botkube_login.md | 38 ----- cmd/cli/docs/botkube_migrate.md | 71 --------- internal/analytics/report_panic.go | 16 +- internal/analytics/report_panic_test.go | 151 ------------------- internal/analytics/segment_logger_adapter.go | 3 +- internal/analytics/segment_reporter.go | 2 +- 13 files changed, 13 insertions(+), 518 deletions(-) delete mode 100644 .github/workflows/prod-e2e-test.yml delete mode 100644 cmd/cli/cmd/login.go delete mode 100644 cmd/cli/cmd/migrate.go delete mode 100644 cmd/cli/docs/botkube_login.md delete mode 100644 cmd/cli/docs/botkube_migrate.md delete mode 100644 internal/analytics/report_panic_test.go diff --git a/.github/workflows/branch-build.yml b/.github/workflows/branch-build.yml index d000dc894..5024b01ee 100644 --- a/.github/workflows/branch-build.yml +++ b/.github/workflows/branch-build.yml @@ -86,9 +86,9 @@ jobs: matrix: integration: - - slack + # - slack they are cloud based + # - teams they are cloud based - discord - - teams steps: - name: Checkout code diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 638c46671..fb2d8593a 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -193,9 +193,9 @@ jobs: matrix: integration: - - slack + # - slack they are cloud based + # - teams they are cloud based - discord - - teams steps: - name: Checkout code diff --git a/.github/workflows/prod-e2e-test.yml b/.github/workflows/prod-e2e-test.yml deleted file mode 100644 index da4d6eb80..000000000 --- a/.github/workflows/prod-e2e-test.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Botkube Cloud Prod E2E test - -on: - workflow_dispatch: - schedule: - - cron: "0 */2 * * *" # every 2 hours - -env: - HELM_VERSION: v3.9.0 - K3D_VERSION: v5.4.6 - GIT_USER: botkube-dev - -jobs: - cloud-slack-prod-e2e: - name: Botkube Cloud Slack Prod E2E - runs-on: ubuntu-latest - permissions: - contents: read - packages: read - concurrency: - group: cloud-slack-prod-e2e - cancel-in-progress: false - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Run e2e tests - uses: ./.github/actions/cloud-slack-e2e - with: - access_token: ${{ secrets.E2E_TEST_GH_DEV_ACCOUNT_PAT }} - - slack_workspace_name: ${{ secrets.E2E_DEV_SLACK_WORKSPACE_NAME }} - slack_email: ${{ secrets.E2E_DEV_SLACK_EMAIL }} - slack_password: ${{ secrets.E2E_DEV_SLACK_USER_PASSWORD }} - slack_bot_display_name: "Botkube" - slack_tester_bot_token: ${{ secrets.E2E_DEV_SLACK_TESTER_BOT_TOKEN }} - slack_tester_bot_name: "botkube3" - - botkube_cloud_api_base_url: "https://api.botkube.io" - botkube_cloud_ui_base_url: "https://app.botkube.io" - botkube_cloud_email: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_EMAIL }} - botkube_cloud_password: ${{ secrets.E2E_DEV_BOTKUBE_CLOUD_PASSWORD }} - botkube_cloud_team_organization_id: ${{ secrets.E2E_PROD_BOTKUBE_CLOUD_TEAM_ORGANIZATION_ID }} - - slack_token: ${{ secrets.SLACK_APP_TOKEN_FOR_CI_ALERTS }} - - e2e_type: "PROD" diff --git a/cmd/cli/cmd/login.go b/cmd/cli/cmd/login.go deleted file mode 100644 index d354cb387..000000000 --- a/cmd/cli/cmd/login.go +++ /dev/null @@ -1,37 +0,0 @@ -package cmd - -import ( - "os" - - "github.com/spf13/cobra" - - "github.com/kubeshop/botkube/internal/cli" - "github.com/kubeshop/botkube/internal/cli/analytics" - "github.com/kubeshop/botkube/internal/cli/heredoc" - "github.com/kubeshop/botkube/internal/cli/login" -) - -// NewLogin returns a cobra.Command for logging into a Botkube Cloud. -func NewLogin() *cobra.Command { - var opts login.Options - - login := &cobra.Command{ - Use: "login [OPTIONS]", - Short: "Login to a Botkube Cloud", - Example: heredoc.WithCLIName(` - # start interactive setup - login - `, cli.Name), - RunE: func(cmd *cobra.Command, args []string) error { - return login.Run(cmd.Context(), os.Stdout, opts) - }, - } - - login = analytics.InjectAnalyticsReporting(*login, "login") - - flags := login.Flags() - flags.StringVar(&opts.CloudDashboardURL, "cloud-dashboard-url", "https://app.botkube.io", "Botkube Cloud URL") - flags.StringVar(&opts.LocalServerAddress, "local-server-addr", "localhost:8085", "Address of a local server which is used for the login flow") - - return login -} diff --git a/cmd/cli/cmd/migrate.go b/cmd/cli/cmd/migrate.go deleted file mode 100644 index 5a2985372..000000000 --- a/cmd/cli/cmd/migrate.go +++ /dev/null @@ -1,142 +0,0 @@ -package cmd - -import ( - "fmt" - "time" - - "github.com/AlecAivazis/survey/v2" - "github.com/fatih/color" - "github.com/pkg/browser" - "github.com/spf13/cobra" - "go.szostok.io/version" - - "github.com/kubeshop/botkube/internal/cli" - "github.com/kubeshop/botkube/internal/cli/analytics" - "github.com/kubeshop/botkube/internal/cli/config" - "github.com/kubeshop/botkube/internal/cli/heredoc" - "github.com/kubeshop/botkube/internal/cli/migrate" - "github.com/kubeshop/botkube/internal/cli/printer" - "github.com/kubeshop/botkube/internal/kubex" -) - -// NewMigrate returns a cobra.Command for migrate the OS into Cloud. -func NewMigrate() *cobra.Command { - var opts migrate.Options - - migrate := &cobra.Command{ - Use: "migrate [OPTIONS]", - Short: "Automatically migrates Botkube installation into Botkube Cloud", - Long: heredoc.WithCLIName(` - Automatically migrates Botkube installation to Botkube Cloud. - This command will create a new Botkube Cloud instance based on your existing Botkube configuration, and upgrade your Botkube installation to use the remote configuration. - - Supported Botkube bot platforms for migration: - - Socket Slack - - Discord - - Mattermost - - Limitations: - - Plugins are sourced from Botkube repository - - Use label selector to choose which Botkube pod you want to migrate. By default it's set to app=botkube. - - Examples: - - $ migrate --label app=botkube --instance-name botkube-slack # Creates new Botkube Cloud instance with name botkube-slack and migrates pod with label app=botkube to it - - `, cli.Name), - RunE: func(cmd *cobra.Command, args []string) (err error) { - k8sConfig, err := kubex.LoadRestConfigWithMetaInformation() - if err != nil { - return fmt.Errorf("while creating k8s config: %w", err) - } - - status := printer.NewStatus(cmd.OutOrStdout(), "Migrating Botkube installation to Cloud") - defer func() { - status.End(err == nil) - }() - - cfg, botkubeVersionStr, err := config.GetFromCluster(cmd.Context(), status, k8sConfig.K8s, opts.ConfigExporter, opts.AutoApprove) - if err != nil { - return err - } - - status.Infof("Checking if Botkube version %q can be migrated safely", botkubeVersionStr) - - botkubeVersionConstraints := migrate.BotkubeVersionConstraints() - isCompatible, err := migrate.IsCompatible(botkubeVersionConstraints, botkubeVersionStr) - if err != nil { - status.Infof("Unable to check if Botkube version %q is within range of Botkube version constraints %q: %s", botkubeVersionStr, botkubeVersionConstraints, err.Error()) - // continue anyway as this shouldn't fail the whole migration - } - if !isCompatible && !opts.AutoApprove { - run := false - - prompt := &survey.Confirm{ - Message: heredoc.Docf(` - - The migration process for the Botkube CLI you're using (version: %q) wasn't tested with your Botkube version on your cluster (%q). - Botkube version constraints for the currently installed CLI: %s - We recommend upgrading your CLI to the latest version. In order to do so, navigate to https://docs.botkube.io/. - - Do you wish to continue?`, version.Get().Version, botkubeVersionStr, botkubeVersionConstraints), - Default: false, - } - - err = survey.AskOne(prompt, &run) - if err != nil { - return err - } - if !run { - status.Infof("Aborting migration.") - return nil - } - } - - status.Step("Run Botkube migration") - instanceID, err := migrate.Run(cmd.Context(), status, cfg, k8sConfig, opts) - if err != nil { - return err - } - - okCheck := color.New(color.FgGreen).FprintlnFunc() - okCheck(cmd.OutOrStdout(), "\nMigration Succeeded 🎉") - - instanceURL := fmt.Sprintf("%s/instances/%s", opts.CloudDashboardURL, instanceID) - - if opts.SkipOpenBrowser { - fmt.Println(heredoc.Docf(` - Visit the URL to see your instance details: - %s - `, instanceURL)) - return nil - } - - fmt.Println(heredoc.Docf(` - If your browser didn't open automatically, visit the URL to see your instance details: - %s - `, instanceURL)) - return browser.OpenURL(instanceURL) - }, - } - - migrate = analytics.InjectAnalyticsReporting(*migrate, "migrate") - - flags := migrate.Flags() - - flags.DurationVar(&opts.Timeout, "timeout", 10*time.Minute, `Maximum time during which the Botkube installation is being watched, where "0" means "infinite". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) - flags.StringVar(&opts.Token, "token", "", "Botkube Cloud authentication token") - flags.BoolVarP(&opts.Watch, "watch", "w", true, "Watches the status of the Botkube installation until it finish or the defined `--timeout` occurs.") - flags.StringVar(&opts.InstanceName, "instance-name", "", "Botkube Cloud Instance name that will be created") - flags.StringVar(&opts.CloudAPIURL, "cloud-api-url", "https://api.botkube.io/graphql", "Botkube Cloud API URL") - flags.StringVar(&opts.CloudDashboardURL, "cloud-dashboard-url", "https://app.botkube.io", "Botkube Cloud URL") - flags.BoolVarP(&opts.SkipConnect, "skip-connect", "q", false, "Skips connecting to Botkube Cloud after migration") - flags.BoolVar(&opts.SkipOpenBrowser, "skip-open-browser", false, "Skips opening web browser after migration") - flags.BoolVarP(&opts.AutoApprove, "auto-approve", "y", false, "Skips interactive approval for upgrading Botkube installation.") - flags.StringVarP(&opts.ImageTag, "image-tag", "", "", `Botkube image tag, e.g. "latest" or "v1.7.0"`) - - opts.ConfigExporter.RegisterFlags(flags) - kubex.RegisterKubeconfigFlag(flags) - - return migrate -} diff --git a/cmd/cli/cmd/root.go b/cmd/cli/cmd/root.go index 77d683526..78975eb82 100644 --- a/cmd/cli/cmd/root.go +++ b/cmd/cli/cmd/root.go @@ -29,11 +29,6 @@ func NewRoot() *cobra.Command { $ install # Install Botkube $ uninstall # Uninstall Botkube - - Botkube Cloud: - - $ login # Login into Botkube Cloud - $ migrate # Automatically migrates Open Source installation into Botkube Cloud `, cli.Name), SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { @@ -44,8 +39,6 @@ func NewRoot() *cobra.Command { cli.RegisterVerboseModeFlag(rootCmd.PersistentFlags()) rootCmd.AddCommand( - NewLogin(), - NewMigrate(), NewDocs(), NewInstall(), NewUninstall(), diff --git a/cmd/cli/docs/botkube.md b/cmd/cli/docs/botkube.md index eb442377f..3500ead57 100644 --- a/cmd/cli/docs/botkube.md +++ b/cmd/cli/docs/botkube.md @@ -16,11 +16,6 @@ Quick Start: $ botkube install # Install Botkube $ botkube uninstall # Uninstall Botkube - -Botkube Cloud: - - $ botkube login # Login into Botkube Cloud - $ botkube migrate # Automatically migrates Open Source installation into Botkube Cloud ``` @@ -38,8 +33,6 @@ botkube [flags] * [botkube config](botkube_config.md) - This command consists of multiple subcommands for working with Botkube configuration * [botkube install](botkube_install.md) - install or upgrade Botkube in k8s cluster -* [botkube login](botkube_login.md) - Login to a Botkube Cloud -* [botkube migrate](botkube_migrate.md) - Automatically migrates Botkube installation into Botkube Cloud * [botkube telemetry](botkube_telemetry.md) - Configure collection of anonymous analytics * [botkube uninstall](botkube_uninstall.md) - uninstall Botkube from cluster * [botkube version](botkube_version.md) - Print the CLI version diff --git a/cmd/cli/docs/botkube_login.md b/cmd/cli/docs/botkube_login.md deleted file mode 100644 index 264435c4e..000000000 --- a/cmd/cli/docs/botkube_login.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: botkube login ---- - -## botkube login - -Login to a Botkube Cloud - -``` -botkube login [OPTIONS] [flags] -``` - -### Examples - -``` -# start interactive setup -botkube login - -``` - -### Options - -``` - --cloud-dashboard-url string Botkube Cloud URL (default "https://app.botkube.io") - -h, --help help for login - --local-server-addr string Address of a local server which is used for the login flow (default "localhost:8085") -``` - -### Options inherited from parent commands - -``` - -v, --verbose int/string[=simple] Prints more verbose output. Allowed values: 0 - disable, 1 - simple, 2 - trace (default 0 - disable) -``` - -### SEE ALSO - -* [botkube](botkube.md) - Botkube CLI - diff --git a/cmd/cli/docs/botkube_migrate.md b/cmd/cli/docs/botkube_migrate.md deleted file mode 100644 index 0d2d8d3a2..000000000 --- a/cmd/cli/docs/botkube_migrate.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: botkube migrate ---- - -## botkube migrate - -Automatically migrates Botkube installation into Botkube Cloud - -### Synopsis - -Automatically migrates Botkube installation to Botkube Cloud. -This command will create a new Botkube Cloud instance based on your existing Botkube configuration, and upgrade your Botkube installation to use the remote configuration. - -Supported Botkube bot platforms for migration: -- Socket Slack -- Discord -- Mattermost - -Limitations: -- Plugins are sourced from Botkube repository - -Use label selector to choose which Botkube pod you want to migrate. By default it's set to app=botkube. - -Examples: - - $ botkube migrate --label app=botkube --instance-name botkube-slack # Creates new Botkube Cloud instance with name botkube-slack and migrates pod with label app=botkube to it - - - -``` -botkube migrate [OPTIONS] [flags] -``` - -### Options - -``` - -y, --auto-approve Skips interactive approval for upgrading Botkube installation. - --cfg-exporter-image-registry string Registry for the Config Exporter job image (default "ghcr.io") - --cfg-exporter-image-repo string Repository for the Config Exporter job image (default "kubeshop/botkube-config-exporter") - --cfg-exporter-image-tag string Tag of the Config Exporter job image (default "v9.99.9-dev") - --cfg-exporter-poll-period duration Interval used to check if Config Exporter job was finished (default 1s) - --cfg-exporter-timeout duration Maximum execution time for the Config Exporter job (default 1m0s) - --cloud-api-url string Botkube Cloud API URL (default "https://api.botkube.io/graphql") - --cloud-dashboard-url string Botkube Cloud URL (default "https://app.botkube.io") - --cloud-env-api-key string API key environment variable name specified under Deployment for cloud installation. (default "CONFIG_PROVIDER_API_KEY") - --cloud-env-endpoint string Endpoint environment variable name specified under Deployment for cloud installation. (default "CONFIG_PROVIDER_ENDPOINT") - --cloud-env-id string Identifier environment variable name specified under Deployment for cloud installation. (default "CONFIG_PROVIDER_IDENTIFIER") - -h, --help help for migrate - --image-tag string Botkube image tag, e.g. "latest" or "v1.7.0" - --instance-name string Botkube Cloud Instance name that will be created - --kubeconfig string Paths to a kubeconfig. Only required if out-of-cluster. - --kubecontext string The name of the kubeconfig context to use. - -l, --label string Label used for identifying the Botkube pod (default "app=botkube") - -n, --namespace string Namespace of Botkube pod (default "botkube") - -q, --skip-connect Skips connecting to Botkube Cloud after migration - --skip-open-browser Skips opening web browser after migration - --timeout duration Maximum time during which the Botkube installation is being watched, where "0" means "infinite". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default 10m0s) - --token string Botkube Cloud authentication token - -w, --watch --timeout Watches the status of the Botkube installation until it finish or the defined --timeout occurs. (default true) -``` - -### Options inherited from parent commands - -``` - -v, --verbose int/string[=simple] Prints more verbose output. Allowed values: 0 - disable, 1 - simple, 2 - trace (default 0 - disable) -``` - -### SEE ALSO - -* [botkube](botkube.md) - Botkube CLI - diff --git a/internal/analytics/report_panic.go b/internal/analytics/report_panic.go index b8ff617f0..e7765dac8 100644 --- a/internal/analytics/report_panic.go +++ b/internal/analytics/report_panic.go @@ -3,6 +3,8 @@ package analytics import ( "fmt" "runtime/debug" + + "github.com/sirupsen/logrus" ) // FatalErrorAnalyticsReporter reports a fatal errors. @@ -14,17 +16,11 @@ type FatalErrorAnalyticsReporter interface { Close() error } -// ReportPanicLogger is a fakeLogger interface used by ReportPanicIfOccurs function. -type ReportPanicLogger interface { - Errorf(format string, args ...interface{}) - Fatal(args ...interface{}) -} - // ReportPanicIfOccurs recovers from a panic and reports it, and then calls log.Fatal. // This function should be called with `defer` at the beginning of the goroutine logic. // // NOTE: Make sure the reporter is not closed before reporting the panic. It will be cleaned up as a part of this function. -func ReportPanicIfOccurs(logger ReportPanicLogger, reporter FatalErrorAnalyticsReporter) { +func ReportPanicIfOccurs(log logrus.FieldLogger, reporter FatalErrorAnalyticsReporter) { r := recover() if r == nil { return @@ -33,15 +29,15 @@ func ReportPanicIfOccurs(logger ReportPanicLogger, reporter FatalErrorAnalyticsR panicDetailsErr := fmt.Errorf("panic: %v\n\n%s", r, string(debug.Stack())) err := reporter.ReportFatalError(panicDetailsErr) if err != nil { - logger.Errorf("while reporting fatal error: %s", err.Error()) + log.WithError(err).Debug("failed to report panic for analytics") } // Close the reader manually before exiting the app as it won't be cleaned up in other way. closeErr := reporter.Close() if closeErr != nil { - logger.Errorf("while closing the reporter: %s", closeErr.Error()) + log.WithError(closeErr).Debug("failed to close analytics reporter") } // No other option than exiting the app - logger.Fatal(panicDetailsErr) + log.Fatal(panicDetailsErr) } diff --git a/internal/analytics/report_panic_test.go b/internal/analytics/report_panic_test.go deleted file mode 100644 index f83b35794..000000000 --- a/internal/analytics/report_panic_test.go +++ /dev/null @@ -1,151 +0,0 @@ -package analytics_test - -import ( - "errors" - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/kubeshop/botkube/internal/analytics" -) - -func TestReportPanicIfOccurs_Panic(t *testing.T) { - // given - testCases := []struct { - Name string - FnToRun func() - InputReporter *fakeReporter - ExpectedErrMessageSubstr string - ExpectedReportErrMessage string - ExpectedReporterCloseErrMessage string - }{ - { - Name: "Success panic report", - FnToRun: func() { - panic("foo") - }, - InputReporter: &fakeReporter{}, - ExpectedErrMessageSubstr: "panic: foo", - }, - { - Name: "Error during reporting panic", - FnToRun: func() { - panic("foo") - }, - InputReporter: &fakeReporter{closed: true}, - ExpectedErrMessageSubstr: "panic: foo", - ExpectedReportErrMessage: "while reporting fatal error: reporter shouldn't be closed", - }, - { - Name: "Error when closing reporter", - FnToRun: func() { - panic("foo") - }, - InputReporter: &fakeReporter{shouldReturnCloseErr: true}, - ExpectedErrMessageSubstr: "panic: foo", - ExpectedReporterCloseErrMessage: "while closing the reporter: closing error", - }, - } - - for _, tc := range testCases { - t.Run(tc.Name, func(t *testing.T) { - log := &fakeLogger{} - reporter := tc.InputReporter - - testFunc := func() { - defer analytics.ReportPanicIfOccurs(log, reporter) - - panic("foo") - } - - // when - testFunc() - - // then - - // log.Fatal triggered regardless the reporting status - require.Len(t, log.fatalReported, 1) - fatalErr, ok := log.fatalReported[0].(error) - require.True(t, ok) - require.NotNil(t, fatalErr) - assert.Contains(t, fatalErr.Error(), tc.ExpectedErrMessageSubstr) - - // See if a report error was logged (if occurred) - if tc.ExpectedReportErrMessage != "" { - require.Len(t, log.errReported, 1) - assert.Equal(t, tc.ExpectedReportErrMessage, log.errReported[0]) - return - } - - // Panic reported (if reporter didn't return error) - require.NotNil(t, reporter.reportedErr) - assert.Contains(t, reporter.reportedErr.Error(), tc.ExpectedErrMessageSubstr) - assert.True(t, reporter.closed) - - // See if the reporter close error was logged (if occurred) - if tc.ExpectedReporterCloseErrMessage != "" { - require.Len(t, log.errReported, 1) - assert.Equal(t, tc.ExpectedReporterCloseErrMessage, log.errReported[0]) - return - } - - // No errors logged in happy path scenario - assert.Empty(t, log.errReported) - }) - } -} - -func TestReportPanicIfOccurs_NoPanic(t *testing.T) { - //given - log := &fakeLogger{} - reporter := &fakeReporter{shouldReturnCloseErr: true, closed: true} // fails when calling any method - - testFunc := func() { - defer analytics.ReportPanicIfOccurs(log, reporter) - } - - // when - testFunc() - - // then - assert.Empty(t, log.fatalReported) - assert.Empty(t, log.errReported) - assert.Empty(t, reporter.reportedErr) -} - -type fakeReporter struct { - shouldReturnCloseErr bool - reportedErr error - closed bool -} - -func (r *fakeReporter) ReportFatalError(err error) error { - if r.closed { - return errors.New("reporter shouldn't be closed") - } - r.reportedErr = err - return nil -} - -func (r *fakeReporter) Close() error { - r.closed = true - if r.shouldReturnCloseErr { - return errors.New("closing error") - } - return nil -} - -type fakeLogger struct { - fatalReported []interface{} - errReported []string -} - -func (l *fakeLogger) Errorf(format string, args ...interface{}) { - l.errReported = append(l.errReported, fmt.Sprintf(format, args...)) -} - -func (l *fakeLogger) Fatal(args ...interface{}) { - l.fatalReported = append(l.fatalReported, args...) -} diff --git a/internal/analytics/segment_logger_adapter.go b/internal/analytics/segment_logger_adapter.go index 9c5801e0a..1bb4806a8 100644 --- a/internal/analytics/segment_logger_adapter.go +++ b/internal/analytics/segment_logger_adapter.go @@ -21,5 +21,6 @@ func (l *segmentLoggerAdapter) Logf(format string, args ...interface{}) { } func (l *segmentLoggerAdapter) Errorf(format string, args ...interface{}) { - l.log.Errorf(format, args...) + // Segment is optional component, we don't want to spam logs with errors. + l.log.Debugf(format, args...) } diff --git a/internal/analytics/segment_reporter.go b/internal/analytics/segment_reporter.go index 4212ef1ec..5277e21d7 100644 --- a/internal/analytics/segment_reporter.go +++ b/internal/analytics/segment_reporter.go @@ -224,7 +224,7 @@ func (r *SegmentReporter) Run(ctx context.Context) error { case <-ticker.C: err := r.reportHeartbeatEvent() if err != nil { - r.log.WithError(err).Error("Failed to report heartbeat event") + r.log.WithError(err).Debug("Failed to report heartbeat event") r.batchedData.IncrementTimeWindowInHours() continue }