Skip to content

Commit

Permalink
Revert "refactor: disable Sarama metric collection" (#2009)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgacsal authored Jan 3, 2025
1 parent 1cfbf25 commit 5b7da64
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions openmeter/watermill/driver/kafka/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"time"

"github.com/IBM/sarama"
gometrics "github.com/rcrowley/go-metrics"
otelmetric "go.opentelemetry.io/otel/metric"

"github.com/openmeterio/openmeter/app/config"
"github.com/openmeterio/openmeter/openmeter/watermill/driver/kafka/metrics"
)

const (
Expand Down Expand Up @@ -91,19 +91,16 @@ func (o *BrokerOptions) createKafkaConfig(role string) (*sarama.Config, error) {
config.Producer.Retry.Max = 10
config.Producer.Return.Successes = true

//meterRegistry, err := metrics.NewRegistry(metrics.NewRegistryOptions{
// MetricMeter: o.MetricMeter,
// NameTransformFn: SaramaMetricRenamer(role),
// ErrorHandler: metrics.LoggingErrorHandler(o.Logger),
//})
//if err != nil {
// return nil, err
//}
//
//config.MetricRegistry = meterRegistry

// FIXME(chrisgacsal): disable metric collection to test possibler mem/goroutine leak
gometrics.UseNilMetrics = true
meterRegistry, err := metrics.NewRegistry(metrics.NewRegistryOptions{
MetricMeter: o.MetricMeter,
NameTransformFn: SaramaMetricRenamer(role),
ErrorHandler: metrics.LoggingErrorHandler(o.Logger),
})
if err != nil {
return nil, err
}

config.MetricRegistry = meterRegistry

return config, nil
}

0 comments on commit 5b7da64

Please sign in to comment.