Skip to content

Commit

Permalink
refactor some code
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ck3rk3y committed Nov 9, 2023
1 parent 354e55e commit a0a72ea
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 30 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package metrics_client_factory

import (
"github.com/kurtosis-tech/kurtosis/cli/cli/defaults"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/do_nothing_metrics_client_callback"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/metrics_cloud_user_instance_id_helper"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/metrics_user_id_store"
"github.com/kurtosis-tech/kurtosis/cli/cli/kurtosis_cluster_setting"
Expand Down Expand Up @@ -54,7 +53,7 @@ func GetMetricsClient() (metrics_client.MetricsClient, func() error, error) {
clusterType,
sendUserMetrics,
shouldFlushMetricsClientQueueOnEachEvent,
do_nothing_metrics_client_callback.NewDoNothingMetricsClientCallback(),
metrics_client.DoNothingMetricsClientCallback{},
analytics_logger.ConvertLogrusLoggerToAnalyticsLogger(logger),
metrics_client.IsCI(), maybeCloudUserId, maybeCloudInstanceId),
)
Expand Down Expand Up @@ -85,7 +84,7 @@ func GetSegmentClient() (metrics_client.MetricsClient, func() error, error) {
clusterType,
sendUserMetrics,
shouldFlushMetricsClientQueueOnEachEvent,
do_nothing_metrics_client_callback.NewDoNothingMetricsClientCallback(),
metrics_client.DoNothingMetricsClientCallback{},
analytics_logger.ConvertLogrusLoggerToAnalyticsLogger(logger),
metrics_client.IsCI(), maybeCloudUserId, maybeCloudInstanceId),
)
Expand Down
3 changes: 1 addition & 2 deletions cli/cli/kurtosis_config/email_collector/email_collector.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package email_collector

import (
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/do_nothing_metrics_client_callback"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/metrics_cloud_user_instance_id_helper"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/metrics_user_id_store"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/prompt_displayer"
Expand Down Expand Up @@ -54,7 +53,7 @@ func logUserEmailAddressAsMetric(userEmail string) {
resolved_config.DefaultDockerClusterName,
sendUserMetrics,
flushQueueOnEachEvent,
do_nothing_metrics_client_callback.NewDoNothingMetricsClientCallback(),
metrics_client.DoNothingMetricsClientCallback{},
analytics_logger.ConvertLogrusLoggerToAnalyticsLogger(logger),
metrics_client.IsCI(),
maybeCloudUserID,
Expand Down
7 changes: 1 addition & 6 deletions core/server/api_container/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ const (
shouldFlushMetricsClientQueueOnEachEvent = false
)

type doNothingMetricsClientCallback struct{}

func (d doNothingMetricsClientCallback) Success() {}
func (d doNothingMetricsClientCallback) Failure(err error) {}

func main() {
// This allows the filename & function to be reported
logrus.SetReportCaller(logMethodAlongWithLogLine)
Expand Down Expand Up @@ -185,7 +180,7 @@ func runMain() error {
serverArgs.KurtosisBackendType.String(),
serverArgs.DidUserAcceptSendingMetrics,
shouldFlushMetricsClientQueueOnEachEvent,
doNothingMetricsClientCallback{},
metrics_client.DoNothingMetricsClientCallback{},
analytics_logger.ConvertLogrusLoggerToAnalyticsLogger(logger),
serverArgs.IsCI,
serverArgs.CloudUserID,
Expand Down
7 changes: 1 addition & 6 deletions engine/server/engine/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ const (
// because this isn't the API container
var apiContainerModeArgsForKurtosisBackend *backend_creator.APIContainerModeArgs = nil

type doNothingMetricsClientCallback struct{}

func (d doNothingMetricsClientCallback) Success() {}
func (d doNothingMetricsClientCallback) Failure(err error) {}

func main() {
// This allows the filename & function to be reported
logrus.SetReportCaller(logMethodAlongWithLogLine)
Expand Down Expand Up @@ -216,7 +211,7 @@ func runMain() error {
serverArgs.KurtosisBackendType.String(),
serverArgs.DidUserAcceptSendingMetrics,
shouldFlushMetricsClientQueueOnEachEvent,
doNothingMetricsClientCallback{},
metrics_client.DoNothingMetricsClientCallback{},
analytics_logger.ConvertLogrusLoggerToAnalyticsLogger(logger),
serverArgs.IsCI,
serverArgs.CloudUserID,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package metrics_client

type DoNothingMetricsClientCallback struct{}

func (d DoNothingMetricsClientCallback) Success() {}
func (d DoNothingMetricsClientCallback) Failure(err error) {}

0 comments on commit a0a72ea

Please sign in to comment.