Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][healthcheck, healthcheckv2] Use extensioncapabilities instead of extension for interfaces #35001

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions extension/healthcheckextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ require (
go.opentelemetry.io/collector/config/confighttp v0.108.2-0.20240829190554-7da6b618a7ee
go.opentelemetry.io/collector/config/configtls v1.14.2-0.20240829190554-7da6b618a7ee
go.opentelemetry.io/collector/confmap v1.14.2-0.20240829190554-7da6b618a7ee
go.opentelemetry.io/collector/extension v0.108.2-0.20240829190554-7da6b618a7ee
go.opentelemetry.io/collector/extension v0.108.2-0.20240904103727-46d0f7361e34
go.opentelemetry.io/collector/extension/extensioncapabilities v0.0.0-20240904103727-46d0f7361e34
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
)
Expand Down Expand Up @@ -38,7 +39,7 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.56.0 // indirect
github.com/prometheus/common v0.57.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/cors v1.11.0 // indirect
Expand All @@ -64,7 +65,7 @@ require (
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/grpc v1.66.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
14 changes: 8 additions & 6 deletions extension/healthcheckextension/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions extension/healthcheckextension/healthcheckextension.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componentstatus"
"go.opentelemetry.io/collector/extension"
"go.opentelemetry.io/collector/extension/extensioncapabilities"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension/internal/healthcheck"
Expand All @@ -26,7 +26,7 @@ type healthCheckExtension struct {
settings component.TelemetrySettings
}

var _ extension.PipelineWatcher = (*healthCheckExtension)(nil)
var _ extensioncapabilities.PipelineWatcher = (*healthCheckExtension)(nil)

func (hc *healthCheckExtension) Start(ctx context.Context, host component.Host) error {

Expand Down
13 changes: 7 additions & 6 deletions extension/healthcheckv2extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"go.opentelemetry.io/collector/component/componentstatus"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/extension"
"go.opentelemetry.io/collector/extension/extensioncapabilities"
"go.uber.org/multierr"
"go.uber.org/zap"

Expand All @@ -34,8 +35,8 @@ type healthCheckExtension struct {
}

var _ component.Component = (*healthCheckExtension)(nil)
var _ extension.ConfigWatcher = (*healthCheckExtension)(nil)
var _ extension.PipelineWatcher = (*healthCheckExtension)(nil)
var _ extensioncapabilities.ConfigWatcher = (*healthCheckExtension)(nil)
var _ extensioncapabilities.PipelineWatcher = (*healthCheckExtension)(nil)

func newExtension(
ctx context.Context,
Expand Down Expand Up @@ -142,24 +143,24 @@ func (hc *healthCheckExtension) ComponentStatusChanged(
hc.eventCh <- &eventSourcePair{source: source, event: event}
}

// NotifyConfig implements the extension.ConfigWatcher interface.
// NotifyConfig implements the extensioncapabilities.ConfigWatcher interface.
func (hc *healthCheckExtension) NotifyConfig(ctx context.Context, conf *confmap.Conf) error {
var err error
for _, comp := range hc.subcomponents {
if cw, ok := comp.(extension.ConfigWatcher); ok {
if cw, ok := comp.(extensioncapabilities.ConfigWatcher); ok {
err = multierr.Append(err, cw.NotifyConfig(ctx, conf))
}
}
return err
}

// Ready implements the extension.PipelineWatcher interface.
// Ready implements the extensioncapabilities.PipelineWatcher interface.
func (hc *healthCheckExtension) Ready() error {
close(hc.readyCh)
return nil
}

// NotReady implements the extension.PipelineWatcher interface.
// NotReady implements the extensioncapabilities.PipelineWatcher interface.
func (hc *healthCheckExtension) NotReady() error {
return nil
}
Expand Down
5 changes: 3 additions & 2 deletions extension/healthcheckv2extension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ require (
go.opentelemetry.io/collector/config/confignet v0.108.2-0.20240829190554-7da6b618a7ee
go.opentelemetry.io/collector/config/configtls v1.14.2-0.20240829190554-7da6b618a7ee
go.opentelemetry.io/collector/confmap v1.14.2-0.20240829190554-7da6b618a7ee
go.opentelemetry.io/collector/extension v0.108.2-0.20240829190554-7da6b618a7ee
go.opentelemetry.io/collector/extension v0.108.2-0.20240904103727-46d0f7361e34
go.opentelemetry.io/collector/extension/extensioncapabilities v0.0.0-20240904103727-46d0f7361e34
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.0
Expand Down Expand Up @@ -43,7 +44,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.56.0 // indirect
github.com/prometheus/common v0.57.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rs/cors v1.11.0 // indirect
go.opentelemetry.io/collector v0.108.2-0.20240829190554-7da6b618a7ee // indirect
Expand Down
10 changes: 6 additions & 4 deletions extension/healthcheckv2extension/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions extension/healthcheckv2extension/internal/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"go.opentelemetry.io/collector/component/componentstatus"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/extension"

Check failure on line 19 in extension/healthcheckv2extension/internal/http/server.go

View workflow job for this annotation

GitHub Actions / govulncheck (extension)

"go.opentelemetry.io/collector/extension" imported and not used
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/common"
Expand All @@ -36,7 +36,7 @@
}

var _ component.Component = (*Server)(nil)
var _ extension.ConfigWatcher = (*Server)(nil)
var _ extensioncapabilities.ConfigWatcher = (*Server)(nil)

Check failure on line 39 in extension/healthcheckv2extension/internal/http/server.go

View workflow job for this annotation

GitHub Actions / govulncheck (extension)

undefined: extensioncapabilities

func NewServer(
config *Config,
Expand Down Expand Up @@ -114,7 +114,7 @@
return nil
}

// NotifyConfig implements the extension.ConfigWatcher interface.
// NotifyConfig implements the extensioncapabilities.ConfigWatcher interface.
func (s *Server) NotifyConfig(_ context.Context, conf *confmap.Conf) error {
confBytes, err := json.Marshal(conf.ToStringMap())
if err != nil {
Expand Down
Loading