Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
BinaryFissionGames committed Jun 19, 2024
1 parent 4bb4a30 commit 7f03222
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions extension/bindplaneextension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/extension/opampcustommessages"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.uber.org/zap"
)

type bindplaneExtension struct {
logger *zap.Logger
cfg *Config
ctmr *measurements.ConcreteThroughputMeasurementsRegistry
ctmr *measurements.ResettableThroughputMeasurementsRegistry
customCapabilityHandler opampcustommessages.CustomCapabilityHandler
doneChan chan struct{}
wg *sync.WaitGroup
}

func newBindplaneExtension(cfg *Config) *bindplaneExtension {
func newBindplaneExtension(logger *zap.Logger, cfg *Config) *bindplaneExtension {
return &bindplaneExtension{
logger: logger,
cfg: cfg,
ctmr: measurements.NewConcreteThroughputMeasurementsRegistry(false),
ctmr: measurements.NewResettableThroughputMeasurementsRegistry(false),
doneChan: make(chan struct{}),
wg: &sync.WaitGroup{},
}
Expand Down Expand Up @@ -110,7 +113,10 @@ func (b *bindplaneExtension) reportMetricsLoop() {
for {
select {
case <-t.C:
b.reportMetrics()
err := b.reportMetrics()
if err != nil {
b.logger.Error("Failed to report throughput metrics.", zap.Error(err))
}
case <-b.doneChan:
return
}
Expand Down
4 changes: 2 additions & 2 deletions extension/bindplaneextension/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func defaultConfig() component.Config {
return &Config{}
}

func createBindPlaneExtension(_ context.Context, _ extension.CreateSettings, cfg component.Config) (extension.Extension, error) {
func createBindPlaneExtension(_ context.Context, cs extension.CreateSettings, cfg component.Config) (extension.Extension, error) {
oCfg := cfg.(*Config)

return newBindplaneExtension(oCfg), nil
return newBindplaneExtension(cs.Logger, oCfg), nil
}

0 comments on commit 7f03222

Please sign in to comment.