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] Extract zookeeper scraper as standalone module #37388

Merged
Merged
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ receiver/windowsperfcountersreceiver/ @open-telemetry
receiver/zipkinreceiver/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @andrzej-stencel @crobert-1
receiver/zookeeperreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski

scraper/zookeeperscraper/ @open-telemetry/collector-contrib-approvers @djaglowski

testbed/ @open-telemetry/collector-contrib-approvers @open-telemetry/collector-approvers
testbed/mockdatasenders/mockdatadogagentexporter/ @open-telemetry/collector-contrib-approvers @boostchicken

Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ body:
- receiver/windowsperfcounters
- receiver/zipkin
- receiver/zookeeper
- scraper/zookeeperscraper
- testbed
- testbed/mockdatasenders/mockdatadogagentexporter
# End Collector components list
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ body:
- receiver/windowsperfcounters
- receiver/zipkin
- receiver/zookeeper
- scraper/zookeeperscraper
- testbed
- testbed/mockdatasenders/mockdatadogagentexporter
# End Collector components list
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ body:
- receiver/windowsperfcounters
- receiver/zipkin
- receiver/zookeeper
- scraper/zookeeperscraper
- testbed
- testbed/mockdatasenders/mockdatadogagentexporter
# End Collector components list
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/unmaintained.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ body:
- receiver/windowsperfcounters
- receiver/zipkin
- receiver/zookeeper
- scraper/zookeeperscraper
- testbed
- testbed/mockdatasenders/mockdatadogagentexporter
# End Collector components list
Expand Down
1 change: 0 additions & 1 deletion cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,3 @@ providers:
# When using `make genotelcontribcol`, a `replaces` section is appended to this
# file before passing it to OCB, to ensure that local versions are used for all
# Contrib modules.

8 changes: 2 additions & 6 deletions receiver/zookeeperreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ receivers:
initial_delay: 1s
```
## Metrics
## Scraper
Details about the metrics produced by this receiver can be found in [metadata.yaml](./metadata.yaml) with further documentation in [documentation.md](./documentation.md)
## Limitations
This receiver does not support scraping metrics from Zookeeper's [New Metric System](https://zookeeper.apache.org/doc/r3.6.3/zookeeperMonitor.html#Metrics-System).
Details about the scraper in [README.md](../../scraper/zookeeperscraper/README.md)
6 changes: 2 additions & 4 deletions receiver/zookeeperreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
package zookeeperreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookeeperreceiver"

import (
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/scraper/scraperhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookeeperreceiver/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/scraper/zookeeperscraper"
)

type Config struct {
scraperhelper.ControllerConfig `mapstructure:",squash"`
confignet.TCPAddrConfig `mapstructure:",squash"`
metadata.MetricsBuilderConfig `mapstructure:",squash"`
zookeeperscraper.Config `mapstructure:",squash"`
}
26 changes: 5 additions & 21 deletions receiver/zookeeperreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import (
"time"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/scraper"
"go.opentelemetry.io/collector/scraper/scraperhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookeeperreceiver/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/scraper/zookeeperscraper"
)

const (
defaultEndpoint = "localhost:2181"
defaultCollectionInterval = 10 * time.Second
defaultTimeout = 10 * time.Second
)

var sFact = zookeeperscraper.NewFactory()

func NewFactory() receiver.Factory {
return receiver.NewFactory(
metadata.Type,
Expand All @@ -38,10 +38,7 @@ func createDefaultConfig() component.Config {

return &Config{
ControllerConfig: cfg,
TCPAddrConfig: confignet.TCPAddrConfig{
Endpoint: defaultEndpoint,
},
MetricsBuilderConfig: metadata.DefaultMetricsBuilderConfig(),
Config: *sFact.CreateDefaultConfig().(*zookeeperscraper.Config),
}
}

Expand All @@ -53,23 +50,10 @@ func createMetricsReceiver(
consumer consumer.Metrics,
) (receiver.Metrics, error) {
rConfig := config.(*Config)
zms, err := newZookeeperMetricsScraper(params, rConfig)
if err != nil {
return nil, err
}

scrp, err := scraper.NewMetrics(
zms.scrape,
scraper.WithShutdown(zms.shutdown),
)
if err != nil {
return nil, err
}

return scraperhelper.NewMetricsController(
&rConfig.ControllerConfig,
params,
consumer,
scraperhelper.AddScraper(metadata.Type, scrp),
scraperhelper.AddFactoryWithConfig(sFact, &rConfig.Config),
)
}
77 changes: 0 additions & 77 deletions receiver/zookeeperreceiver/factory_test.go

This file was deleted.

41 changes: 20 additions & 21 deletions receiver/zookeeperreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,20 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zookee
go 1.22.0

require (
github.com/google/go-cmp v0.6.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.118.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.118.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.118.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.118.0
github.com/open-telemetry/opentelemetry-collector-contrib/scraper/zookeeperscraper v0.118.0
github.com/stretchr/testify v1.10.0
github.com/testcontainers/testcontainers-go v0.35.0
go.opentelemetry.io/collector/component v0.118.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/component/componenttest v0.118.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/config/confignet v1.24.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/confmap v1.24.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/consumer v1.24.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/consumer/consumertest v0.118.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/filter v0.118.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/pdata v1.24.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/receiver v0.118.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/receiver/receivertest v0.118.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/scraper v0.118.1-0.20250130000211-c119b2a55eb4
go.opentelemetry.io/collector/scraper/scraperhelper v0.118.1-0.20250130000211-c119b2a55eb4
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
)

require (
Expand All @@ -47,7 +40,6 @@ require (
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
Expand All @@ -66,6 +58,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.118.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.118.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
Expand All @@ -79,40 +72,36 @@ require (
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/collector/config/confignet v1.24.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.118.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.118.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.118.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/featuregate v1.24.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/filter v0.118.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/pdata v1.24.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.118.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/pipeline v0.118.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/receiver/xreceiver v0.118.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/collector/scraper v0.118.1-0.20250130000211-c119b2a55eb4 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
go.opentelemetry.io/otel/metric v1.34.0 // indirect
go.opentelemetry.io/otel/sdk v1.34.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.34.0 // indirect
go.opentelemetry.io/otel/trace v1.34.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
google.golang.org/grpc v1.70.0 // indirect
google.golang.org/protobuf v1.36.4 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => ../../internal/common

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal => ../../internal/coreinternal

// see https://github.com/distribution/distribution/issues/3590
exclude github.com/docker/distribution v2.8.0+incompatible

Expand All @@ -122,4 +111,14 @@ retract (
v0.65.0
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal => ../../internal/coreinternal

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest

replace github.com/open-telemetry/opentelemetry-collector-contrib/scraper/zookeeperscraper => ../../scraper/zookeeperscraper

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => ../../internal/common
22 changes: 12 additions & 10 deletions receiver/zookeeperreceiver/go.sum

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

Loading
Loading