diff --git a/.github/workflows/build-and-test-windows.yaml b/.github/workflows/build-and-test-windows.yaml index 04d2b514451..533d2ed0bfe 100644 --- a/.github/workflows/build-and-test-windows.yaml +++ b/.github/workflows/build-and-test-windows.yaml @@ -16,11 +16,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.17 - - name: Setup Go Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - shell: bash - name: Cache Go uses: actions/cache@v3 env: diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index f7e119ec312..44c26bc2a57 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -16,10 +16,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.17 - - name: Setup Go Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Cache Go id: go-cache uses: actions/cache@v3 @@ -34,6 +30,7 @@ jobs: - name: Install Tools if: steps.go-cache.outputs.cache-hit != 'true' run: make install-tools + lint: runs-on: ubuntu-latest needs: [setup-environment] @@ -44,10 +41,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.17 - - name: Setup Go Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Cache Go id: go-cache uses: actions/cache@v3 @@ -71,10 +64,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.17 - - name: Setup Go Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Cache Go id: go-cache uses: actions/cache@v3 @@ -111,6 +100,7 @@ jobs: git diff -s --exit-code || (echo 'Generated code is out of date, please run "make genotelcorecol" and commit the changes in this PR.' && exit 1) - name: Multimod verify run: make multimod-verify + unittest: strategy: matrix: @@ -124,10 +114,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - - name: Setup Go Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Cache Go id: go-cache uses: actions/cache@v3 @@ -143,6 +129,7 @@ jobs: key: unittest-${{ runner.os }}-go-build-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} - name: Run Unit Tests run: make gotest + test-coverage: runs-on: ubuntu-latest needs: [setup-environment] @@ -153,10 +140,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.17 - - name: Setup Go Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Cache Go id: go-cache uses: actions/cache@v3 @@ -178,6 +161,7 @@ jobs: file: ./coverage.txt fail_ci_if_error: true verbose: true + cross-build-collector: needs: [setup-environment] runs-on: ubuntu-latest @@ -212,10 +196,6 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.17 - - name: Setup Go Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Cache Go id: go-cache uses: actions/cache@v3 diff --git a/.github/workflows/builder-integration-test.yaml b/.github/workflows/builder-integration-test.yaml index 0d24e2c00c6..6d80c721732 100644 --- a/.github/workflows/builder-integration-test.yaml +++ b/.github/workflows/builder-integration-test.yaml @@ -23,16 +23,13 @@ on: jobs: integration-test: name: Integration test - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: 1.17 - - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - - name: Test - run: cd ./cmd/builder && ./test/test.sh + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.17 + - name: Test + run: cd ./cmd/builder && ./test/test.sh diff --git a/.github/workflows/builder-release.yaml b/.github/workflows/builder-release.yaml index 73bd01a79e5..b1ddb44a606 100644 --- a/.github/workflows/builder-release.yaml +++ b/.github/workflows/builder-release.yaml @@ -7,20 +7,17 @@ on: jobs: goreleaser: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout Repo uses: actions/checkout@v3 with: fetch-depth: 0 - - - name: Set up Go + - name: Setup Go uses: actions/setup-go@v3 with: go-version: 1.17 - - - name: Run GoReleaser + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: distribution: goreleaser-pro diff --git a/.github/workflows/contrib-tests.yml b/.github/workflows/contrib-tests.yml index e4593b72dbf..83e87ff0a8b 100644 --- a/.github/workflows/contrib-tests.yml +++ b/.github/workflows/contrib-tests.yml @@ -9,13 +9,13 @@ on: jobs: contrib_tests: runs-on: ubuntu-latest - container: - image: cimg/go:1.17 steps: - - name: Setup Permissions - run: sudo chmod -R 777 $GITHUB_WORKSPACE /github /__w/_temp - name: Checkout Repo uses: actions/checkout@v3 + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.17 - name: Run Contrib Tests run: | contrib_path=/tmp/opentelemetry-collector-contrib diff --git a/CHANGELOG.md b/CHANGELOG.md index afb8aca498a..e4b573d4750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,16 +4,44 @@ ### 🛑 Breaking changes 🛑 +- Remove `configunmarshaler.Unmarshaler` interface, per deprecation comment )#5348) +- Remove deprecated pdata funcs/structs from v0.50.0 (#5345) +- Remove derecated featuregate funcs/structs from v0.50.0 (#5346) + +### 🚩 Deprecations 🚩 + +### 💡 Enhancements 💡 + +- Update OTLP to v0.17.0 (#5335) + +### 🧰 Bug fixes 🧰 + +## v0.51.0 Beta + +### 🛑 Breaking changes 🛑 + - Remove deprecated model module, everything is available in `pdata` and `semconv`. (#5281) - Old versions of the module are still available, but no new versions will be released. - Remove deprecated LogRecord.Name field. (#5202) ### 🚩 Deprecations 🚩 +- In preparation of migration to immutable slices for primitive type items, the following methods are renamed (#5344) + - `Value.BytesVal` func is deprecated in favor of `Value.MBytesVal`. + - `Value.SetBytesVal` func is deprecated in favor of `Value.SetMBytesVal`. + - `Value.UpdateBytes` func is deprecated in favor of `Value.UpdateMBytes`. + - `Value.InsertBytes` func is deprecated in favor of `Value.InsertMBytes`. + - `Value.UpsertBytes` func is deprecated in favor of `Value.UpsertMBytes`. + - `.BucketCounts` funcs are deprecated in favor of + `.MBucketCounts`. + - `.SetBucketCounts` funcs are deprecated in favor of + `.SetMBucketCounts`. + - `HistogramDataPoint.ExplicitBounds` func is deprecated in favor of `HistogramDataPoint.MExplicitBounds`. + - `HistogramDataPoint.SetExplicitBounds` func is deprecated in favor of `HistogramDataPoint.SetMExplicitBounds`. + ### 💡 Enhancements 💡 -- `pdata`: Expose `pcommon.NewSliceFromRay` and `pcommon.Slice.AsRaw` functions (#5298) -- Update OTLP to v0.17.0 (#5335) +- `pdata`: Expose `pcommon.NewSliceFromRaw` and `pcommon.Slice.AsRaw` functions (#5311) ### 🧰 Bug fixes 🧰 diff --git a/Makefile b/Makefile index 554cd730bd6..6358b1190bf 100644 --- a/Makefile +++ b/Makefile @@ -361,4 +361,5 @@ multimod-verify: install-tools .PHONY: multimod-prerelease multimod-prerelease: install-tools - multimod prerelease -v ./versions.yaml -m collector-base + multimod prerelease -v ./versions.yaml -m collector-core + $(MAKE) gotidy diff --git a/cmd/builder/internal/builder/config.go b/cmd/builder/internal/builder/config.go index 07b62e6d5d1..67ed861b3fb 100644 --- a/cmd/builder/internal/builder/config.go +++ b/cmd/builder/internal/builder/config.go @@ -25,7 +25,7 @@ import ( "go.uber.org/zap" ) -const defaultOtelColVersion = "0.50.0" +const defaultOtelColVersion = "0.51.0" // ErrInvalidGoMod indicates an invalid gomod var ErrInvalidGoMod = errors.New("invalid gomod specification for module") diff --git a/cmd/otelcorecol/builder-config.yaml b/cmd/otelcorecol/builder-config.yaml index 47b049f9eb6..aaa45f9d1b7 100644 --- a/cmd/otelcorecol/builder-config.yaml +++ b/cmd/otelcorecol/builder-config.yaml @@ -2,29 +2,29 @@ dist: module: go.opentelemetry.io/collector/cmd/otelcorecol name: otelcorecol description: Local OpenTelemetry Collector binary, testing only. - version: 0.50.0-dev - otelcol_version: 0.50.0 + version: 0.51.0-dev + otelcol_version: 0.51.0 receivers: - import: go.opentelemetry.io/collector/receiver/otlpreceiver - gomod: go.opentelemetry.io/collector v0.50.0 + gomod: go.opentelemetry.io/collector v0.51.0 exporters: - import: go.opentelemetry.io/collector/exporter/loggingexporter - gomod: go.opentelemetry.io/collector v0.50.0 + gomod: go.opentelemetry.io/collector v0.51.0 - import: go.opentelemetry.io/collector/exporter/otlpexporter - gomod: go.opentelemetry.io/collector v0.50.0 + gomod: go.opentelemetry.io/collector v0.51.0 - import: go.opentelemetry.io/collector/exporter/otlphttpexporter - gomod: go.opentelemetry.io/collector v0.50.0 + gomod: go.opentelemetry.io/collector v0.51.0 extensions: - import: go.opentelemetry.io/collector/extension/ballastextension - gomod: go.opentelemetry.io/collector v0.50.0 + gomod: go.opentelemetry.io/collector v0.51.0 - import: go.opentelemetry.io/collector/extension/zpagesextension - gomod: go.opentelemetry.io/collector v0.50.0 + gomod: go.opentelemetry.io/collector v0.51.0 processors: - import: go.opentelemetry.io/collector/processor/batchprocessor - gomod: go.opentelemetry.io/collector v0.50.0 + gomod: go.opentelemetry.io/collector v0.51.0 - import: go.opentelemetry.io/collector/processor/memorylimiterprocessor - gomod: go.opentelemetry.io/collector v0.50.0 + gomod: go.opentelemetry.io/collector v0.51.0 replaces: - go.opentelemetry.io/collector => ../../ diff --git a/cmd/otelcorecol/go.mod b/cmd/otelcorecol/go.mod index 91579cfd502..b7f662a1a19 100644 --- a/cmd/otelcorecol/go.mod +++ b/cmd/otelcorecol/go.mod @@ -6,7 +6,7 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/collector v0.50.0 + go.opentelemetry.io/collector v0.51.0 golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 ) @@ -55,8 +55,8 @@ require ( github.com/tklauser/numcpus v0.4.0 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect go.opencensus.io v0.23.0 // indirect - go.opentelemetry.io/collector/pdata v0.50.0 // indirect - go.opentelemetry.io/collector/semconv v0.50.0 // indirect + go.opentelemetry.io/collector/pdata v0.51.0 // indirect + go.opentelemetry.io/collector/semconv v0.51.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.32.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 // indirect go.opentelemetry.io/contrib/zpages v0.32.0 // indirect diff --git a/cmd/otelcorecol/main.go b/cmd/otelcorecol/main.go index 90abf37eccc..4ef143ed0c8 100644 --- a/cmd/otelcorecol/main.go +++ b/cmd/otelcorecol/main.go @@ -21,7 +21,7 @@ func main() { info := component.BuildInfo{ Command: "otelcorecol", Description: "Local OpenTelemetry Collector binary, testing only.", - Version: "0.50.0-dev", + Version: "0.51.0-dev", } if err := run(service.CollectorSettings{BuildInfo: info, Factories: factories}); err != nil { diff --git a/config/configtelemetry/configtelemetry.go b/config/configtelemetry/configtelemetry.go index 326c9f2e6d6..3f3b9b18576 100644 --- a/config/configtelemetry/configtelemetry.go +++ b/config/configtelemetry/configtelemetry.go @@ -56,30 +56,26 @@ func (l Level) String() string { return "unknown" } -// UnmarshalText unmarshals text to a Level. +// UnmarshalText unmarshalls text to a Level. func (l *Level) UnmarshalText(text []byte) error { if l == nil { return fmt.Errorf("cannot unmarshal to a nil *Level") } - var err error - *l, err = parseLevel(string(text)) - return err -} - -// parseLevel returns the Level represented by the string. The parsing is case-insensitive -// and it returns error if the string value is unknown. -func parseLevel(str string) (Level, error) { - str = strings.ToLower(str) + str := strings.ToLower(string(text)) switch str { case levelNoneStr: - return LevelNone, nil + *l = LevelNone + return nil case levelBasicStr: - return LevelBasic, nil + *l = LevelBasic + return nil case levelNormalStr: - return LevelNormal, nil + *l = LevelNormal + return nil case levelDetailedStr: - return LevelDetailed, nil + *l = LevelDetailed + return nil } - return LevelNone, fmt.Errorf("unknown metrics level %q", str) + return fmt.Errorf("unknown metrics level %q", str) } diff --git a/config/configtelemetry/configtelemetry_test.go b/config/configtelemetry/configtelemetry_test.go index 4e0b1b57f70..7eb8b84af11 100644 --- a/config/configtelemetry/configtelemetry_test.go +++ b/config/configtelemetry/configtelemetry_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestParseFrom(t *testing.T) { +func TestUnmarshalText(t *testing.T) { tests := []struct { str string level Level @@ -56,17 +56,23 @@ func TestParseFrom(t *testing.T) { for _, test := range tests { t.Run(test.str, func(t *testing.T) { - lvl, err := parseLevel(test.str) + var lvl Level + err := lvl.UnmarshalText([]byte(test.str)) if test.err { assert.Error(t, err) } else { assert.NoError(t, err) + assert.Equal(t, test.level, lvl) } - assert.Equal(t, test.level, lvl) }) } } +func TestUnmarshalTextNilLevel(t *testing.T) { + lvl := (*Level)(nil) + assert.Error(t, lvl.UnmarshalText([]byte(levelNormalStr))) +} + func TestLevelString(t *testing.T) { tests := []struct { str string diff --git a/config/configunmarshaler/doc.go b/config/configunmarshaler/doc.go deleted file mode 100644 index d2a55f05223..00000000000 --- a/config/configunmarshaler/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package configunmarshaler implements configuration unmarshalling from a config.Map. -// The implementation relies on registered factories that allow creating -// default configuration for each type of receiver/exporter/processor. -package configunmarshaler // import "go.opentelemetry.io/collector/config/configunmarshaler" diff --git a/config/configunmarshaler/unmarshaler.go b/config/configunmarshaler/unmarshaler.go deleted file mode 100644 index d92df284046..00000000000 --- a/config/configunmarshaler/unmarshaler.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package configunmarshaler // import "go.opentelemetry.io/collector/config/configunmarshaler" - -import ( - "go.opentelemetry.io/collector/internal/configunmarshaler" -) - -// Deprecated: [v0.50.0] if you need to update the config.Config implement custom (or wrap) service.ConfigProvider. -type ConfigUnmarshaler = configunmarshaler.ConfigUnmarshaler - -// Deprecated: [v0.50.0] not needed since interface will be removed. -var NewDefault = configunmarshaler.NewDefault - -// Deprecated: [v0.50.0] use config.UnmarshalReceiver. -var LoadReceiver = configunmarshaler.LoadReceiver diff --git a/examples/k8s/otel-config.yaml b/examples/k8s/otel-config.yaml index 0f520526120..1d78fd5bb0e 100644 --- a/examples/k8s/otel-config.yaml +++ b/examples/k8s/otel-config.yaml @@ -177,7 +177,7 @@ spec: - command: - "/otelcol" - "--config=/conf/otel-collector-config.yaml" - image: otel/opentelemetry-collector:0.50.0 + image: otel/opentelemetry-collector:0.51.0 name: otel-collector resources: limits: diff --git a/extension/zpagesextension/factory.go b/extension/zpagesextension/factory.go index 5d262a2804c..56483705ea7 100644 --- a/extension/zpagesextension/factory.go +++ b/extension/zpagesextension/factory.go @@ -45,5 +45,5 @@ func createDefaultConfig() config.Extension { // createExtension creates the extension based on this config. func createExtension(_ context.Context, set component.ExtensionCreateSettings, cfg config.Extension) (component.Extension, error) { - return newServer(cfg.(*Config), set.Logger), nil + return newServer(cfg.(*Config), set.TelemetrySettings), nil } diff --git a/extension/zpagesextension/zpagesextension.go b/extension/zpagesextension/zpagesextension.go index 22db8ae7c19..7cc942ead3d 100644 --- a/extension/zpagesextension/zpagesextension.go +++ b/extension/zpagesextension/zpagesextension.go @@ -17,30 +17,62 @@ package zpagesextension // import "go.opentelemetry.io/collector/extension/zpage import ( "context" "net/http" + "path" + "go.opentelemetry.io/contrib/zpages" + "go.opentelemetry.io/otel/sdk/trace" "go.uber.org/zap" "go.opentelemetry.io/collector/component" ) +const ( + tracezPath = "tracez" +) + type zpagesExtension struct { - config *Config - logger *zap.Logger - server http.Server - stopCh chan struct{} + config *Config + telemetry component.TelemetrySettings + zpagesSpanProcessor *zpages.SpanProcessor + server http.Server + stopCh chan struct{} +} + +// registerableTracerProvider is a tracer that supports +// the SDK methods RegisterSpanProcessor and UnregisterSpanProcessor. +// +// We use an interface instead of casting to the SDK tracer type to support tracer providers +// that extend the SDK. +type registerableTracerProvider interface { + // RegisterSpanProcessor adds the given SpanProcessor to the list of SpanProcessors. + // https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#TracerProvider.RegisterSpanProcessor. + RegisterSpanProcessor(SpanProcessor trace.SpanProcessor) + + // UnregisterSpanProcessor removes the given SpanProcessor from the list of SpanProcessors. + // https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#TracerProvider.UnregisterSpanProcessor. + UnregisterSpanProcessor(SpanProcessor trace.SpanProcessor) } func (zpe *zpagesExtension) Start(_ context.Context, host component.Host) error { zPagesMux := http.NewServeMux() + sdktracer, ok := zpe.telemetry.TracerProvider.(registerableTracerProvider) + if ok { + sdktracer.RegisterSpanProcessor(zpe.zpagesSpanProcessor) + zPagesMux.Handle(path.Join("/debug", tracezPath), zpages.NewTracezHandler(zpe.zpagesSpanProcessor)) + zpe.telemetry.Logger.Info("Registered zPages span processor on tracer provider") + } else { + zpe.telemetry.Logger.Warn("zPages span processor registration is not available") + } + hostZPages, ok := host.(interface { RegisterZPages(mux *http.ServeMux, pathPrefix string) }) if ok { - zpe.logger.Info("Register Host's zPages") hostZPages.RegisterZPages(zPagesMux, "/debug") + zpe.telemetry.Logger.Info("Registered Host's zPages") } else { - zpe.logger.Info("Host's zPages not available") + zpe.telemetry.Logger.Warn("Host's zPages not available") } // Start the listener here so we can have earlier failure if port is @@ -50,7 +82,7 @@ func (zpe *zpagesExtension) Start(_ context.Context, host component.Host) error return err } - zpe.logger.Info("Starting zPages extension", zap.Any("config", zpe.config)) + zpe.telemetry.Logger.Info("Starting zPages extension", zap.Any("config", zpe.config)) zpe.server = http.Server{Handler: zPagesMux} zpe.stopCh = make(chan struct{}) go func() { @@ -69,12 +101,22 @@ func (zpe *zpagesExtension) Shutdown(context.Context) error { if zpe.stopCh != nil { <-zpe.stopCh } + + sdktracer, ok := zpe.telemetry.TracerProvider.(registerableTracerProvider) + if ok { + sdktracer.UnregisterSpanProcessor(zpe.zpagesSpanProcessor) + zpe.telemetry.Logger.Info("Unregistered zPages span processor on tracer provider") + } else { + zpe.telemetry.Logger.Warn("zPages span processor registration is not available") + } + return err } -func newServer(config *Config, logger *zap.Logger) *zpagesExtension { +func newServer(config *Config, telemetry component.TelemetrySettings) *zpagesExtension { return &zpagesExtension{ - config: config, - logger: logger, + config: config, + telemetry: telemetry, + zpagesSpanProcessor: zpages.NewSpanProcessor(), } } diff --git a/extension/zpagesextension/zpagesextension_test.go b/extension/zpagesextension/zpagesextension_test.go index 4df59e0b088..103a43eae40 100644 --- a/extension/zpagesextension/zpagesextension_test.go +++ b/extension/zpagesextension/zpagesextension_test.go @@ -18,12 +18,12 @@ import ( "context" "net" "net/http" - "path" "runtime" "testing" "github.com/stretchr/testify/require" - "go.uber.org/zap" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" @@ -39,10 +39,22 @@ func newZPagesHost() *zpagesHost { return &zpagesHost{Host: componenttest.NewNopHost()} } -func (*zpagesHost) RegisterZPages(mux *http.ServeMux, pathPrefix string) { - mux.HandleFunc(path.Join(pathPrefix, "tracez"), func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - }) +func (*zpagesHost) RegisterZPages(mux *http.ServeMux, pathPrefix string) {} + +var _ registerableTracerProvider = (*registerableProvider)(nil) +var _ registerableTracerProvider = sdktrace.NewTracerProvider() + +type registerableProvider struct { + trace.TracerProvider +} + +func (*registerableProvider) RegisterSpanProcessor(sdktrace.SpanProcessor) {} +func (*registerableProvider) UnregisterSpanProcessor(sdktrace.SpanProcessor) {} + +func newZpagesTelemetrySettings() component.TelemetrySettings { + set := componenttest.NewNopTelemetrySettings() + set.TracerProvider = ®isterableProvider{set.TracerProvider} + return set } func TestZPagesExtensionUsage(t *testing.T) { @@ -52,7 +64,7 @@ func TestZPagesExtensionUsage(t *testing.T) { }, } - zpagesExt := newServer(cfg, zap.NewNop()) + zpagesExt := newServer(cfg, newZpagesTelemetrySettings()) require.NotNil(t, zpagesExt) require.NoError(t, zpagesExt.Start(context.Background(), newZPagesHost())) @@ -83,7 +95,7 @@ func TestZPagesExtensionPortAlreadyInUse(t *testing.T) { Endpoint: endpoint, }, } - zpagesExt := newServer(cfg, zap.NewNop()) + zpagesExt := newServer(cfg, newZpagesTelemetrySettings()) require.NotNil(t, zpagesExt) require.Error(t, zpagesExt.Start(context.Background(), componenttest.NewNopHost())) @@ -96,7 +108,7 @@ func TestZPagesMultipleStarts(t *testing.T) { }, } - zpagesExt := newServer(cfg, zap.NewNop()) + zpagesExt := newServer(cfg, newZpagesTelemetrySettings()) require.NotNil(t, zpagesExt) require.NoError(t, zpagesExt.Start(context.Background(), componenttest.NewNopHost())) @@ -113,7 +125,7 @@ func TestZPagesMultipleShutdowns(t *testing.T) { }, } - zpagesExt := newServer(cfg, zap.NewNop()) + zpagesExt := newServer(cfg, newZpagesTelemetrySettings()) require.NotNil(t, zpagesExt) require.NoError(t, zpagesExt.Start(context.Background(), componenttest.NewNopHost())) @@ -128,7 +140,7 @@ func TestZPagesShutdownWithoutStart(t *testing.T) { }, } - zpagesExt := newServer(cfg, zap.NewNop()) + zpagesExt := newServer(cfg, newZpagesTelemetrySettings()) require.NotNil(t, zpagesExt) require.NoError(t, zpagesExt.Shutdown(context.Background())) diff --git a/go.mod b/go.mod index 5ccc11250c0..8f415529451 100644 --- a/go.mod +++ b/go.mod @@ -20,8 +20,8 @@ require ( github.com/spf13/cobra v1.4.0 github.com/stretchr/testify v1.7.1 go.opencensus.io v0.23.0 - go.opentelemetry.io/collector/pdata v0.50.0 - go.opentelemetry.io/collector/semconv v0.50.0 + go.opentelemetry.io/collector/pdata v0.51.0 + go.opentelemetry.io/collector/semconv v0.51.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.32.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 go.opentelemetry.io/contrib/zpages v0.32.0 diff --git a/internal/otlptext/databuffer.go b/internal/otlptext/databuffer.go index f84b446c33c..2e7e4a28d5d 100644 --- a/internal/otlptext/databuffer.go +++ b/internal/otlptext/databuffer.go @@ -119,14 +119,14 @@ func (b *dataBuffer) logDoubleHistogramDataPoints(ps pmetric.HistogramDataPointS b.logEntry("Count: %d", p.Count()) b.logEntry("Sum: %f", p.Sum()) - bounds := p.ExplicitBounds() + bounds := p.MExplicitBounds() if len(bounds) != 0 { for i, bound := range bounds { b.logEntry("ExplicitBounds #%d: %f", i, bound) } } - buckets := p.BucketCounts() + buckets := p.MBucketCounts() if len(buckets) != 0 { for j, bucket := range buckets { b.logEntry("Buckets #%d, Count: %d", j, bucket) @@ -157,13 +157,13 @@ func (b *dataBuffer) logExponentialHistogramDataPoints(ps pmetric.ExponentialHis // uses a lookup table for the last finite boundary, which can be // easily computed using `math/big` (for scales up to 20). - negB := p.Negative().BucketCounts() - posB := p.Positive().BucketCounts() + negB := p.Negative().MBucketCounts() + posB := p.Positive().MBucketCounts() for i := 0; i < len(negB); i++ { pos := len(negB) - i - 1 index := p.Negative().Offset() + int32(pos) - count := p.Negative().BucketCounts()[pos] + count := p.Negative().MBucketCounts()[pos] lower := math.Exp(float64(index) * factor) upper := math.Exp(float64(index+1) * factor) b.logEntry("Bucket (%f, %f], Count: %d", -upper, -lower, count) @@ -175,7 +175,7 @@ func (b *dataBuffer) logExponentialHistogramDataPoints(ps pmetric.ExponentialHis for pos := 0; pos < len(posB); pos++ { index := p.Positive().Offset() + int32(pos) - count := p.Positive().BucketCounts()[pos] + count := p.Positive().MBucketCounts()[pos] lower := math.Exp(float64(index) * factor) upper := math.Exp(float64(index+1) * factor) b.logEntry("Bucket [%f, %f), Count: %d", lower, upper, count) diff --git a/internal/testdata/metric.go b/internal/testdata/metric.go index 76387d21ec4..02737d5b625 100644 --- a/internal/testdata/metric.go +++ b/internal/testdata/metric.go @@ -206,12 +206,12 @@ func initHistogramMetric(hm pmetric.Metric) { hdp1.SetTimestamp(TestMetricTimestamp) hdp1.SetCount(1) hdp1.SetSum(15) - hdp1.SetBucketCounts([]uint64{0, 1}) + hdp1.SetMBucketCounts([]uint64{0, 1}) exemplar := hdp1.Exemplars().AppendEmpty() exemplar.SetTimestamp(TestMetricExemplarTimestamp) exemplar.SetDoubleVal(15) initMetricAttachment(exemplar.FilteredAttributes()) - hdp1.SetExplicitBounds([]float64{1}) + hdp1.SetMExplicitBounds([]float64{1}) } func initExponentialHistogramMetric(hm pmetric.Metric) { @@ -229,10 +229,10 @@ func initExponentialHistogramMetric(hm pmetric.Metric) { // positive index 1 and 2 are values sqrt(2), 2 at scale 1 hdp0.Positive().SetOffset(1) - hdp0.Positive().SetBucketCounts([]uint64{1, 1}) + hdp0.Positive().SetMBucketCounts([]uint64{1, 1}) // negative index -1 and 0 are values -1/sqrt(2), -1 at scale 1 hdp0.Negative().SetOffset(-1) - hdp0.Negative().SetBucketCounts([]uint64{1, 1}) + hdp0.Negative().SetMBucketCounts([]uint64{1, 1}) // The above will print: // Bucket (-1.414214, -1.000000], Count: 1 @@ -252,7 +252,7 @@ func initExponentialHistogramMetric(hm pmetric.Metric) { // index -1 and 0 are values 0.25, 1 at scale -1 hdp1.Positive().SetOffset(-1) - hdp1.Positive().SetBucketCounts([]uint64{1, 1}) + hdp1.Positive().SetMBucketCounts([]uint64{1, 1}) // The above will print: // Bucket [0, 0], Count: 1 diff --git a/pdata/internal/cmd/pdatagen/internal/metrics_structs.go b/pdata/internal/cmd/pdatagen/internal/metrics_structs.go index 863383bd664..a3023fc87f5 100644 --- a/pdata/internal/cmd/pdatagen/internal/metrics_structs.go +++ b/pdata/internal/cmd/pdatagen/internal/metrics_structs.go @@ -476,7 +476,7 @@ var valueFloat64Field = &primitiveField{ } var bucketCountsField = &primitiveSliceField{ - fieldName: "BucketCounts", + fieldName: "MBucketCounts", originFieldName: "BucketCounts", returnType: "[]uint64", defaultVal: "[]uint64(nil)", @@ -485,7 +485,7 @@ var bucketCountsField = &primitiveSliceField{ } var explicitBoundsField = &primitiveSliceField{ - fieldName: "ExplicitBounds", + fieldName: "MExplicitBounds", originFieldName: "ExplicitBounds", returnType: "[]float64", defaultVal: "[]float64(nil)", diff --git a/pdata/internal/common.go b/pdata/internal/common.go index ef31705553d..bc231c02e00 100644 --- a/pdata/internal/common.go +++ b/pdata/internal/common.go @@ -262,10 +262,19 @@ func (v Value) SliceVal() Slice { // If the Type() is not ValueTypeBytes then returns false. // Calling this function on zero-initialized Value will cause a panic. // Modifying the returned []byte in-place is forbidden. +// Deprecated: [0.51.0] Use MBytesVal instead. func (v Value) BytesVal() []byte { return v.orig.GetBytesValue() } +// MBytesVal returns the []byte value associated with this Value. +// If the Type() is not ValueTypeBytes then returns false. +// Calling this function on zero-initialized Value will cause a panic. +// Modifying the returned []byte in-place is forbidden. +func (v Value) MBytesVal() []byte { + return v.orig.GetBytesValue() +} + // SetStringVal replaces the string value associated with this Value, // it also changes the type to be ValueTypeString. // Calling this function on zero-initialized Value will cause a panic. @@ -299,10 +308,20 @@ func (v Value) SetBoolVal(bv bool) { // Calling this function on zero-initialized Value will cause a panic. // The caller must ensure the []byte passed in is not modified after the call is made, sharing the data // across multiple attributes is forbidden. +// Deprecated: [0.51.0] Use SetMBytesVal instead. func (v Value) SetBytesVal(bv []byte) { v.orig.Value = &otlpcommon.AnyValue_BytesValue{BytesValue: bv} } +// SetMBytesVal replaces the []byte value associated with this Value, +// it also changes the type to be ValueTypeBytes. +// Calling this function on zero-initialized Value will cause a panic. +// The caller must ensure the []byte passed in is not modified after the call is made, sharing the data +// across multiple attributes is forbidden. +func (v Value) SetMBytesVal(bv []byte) { + v.orig.Value = &otlpcommon.AnyValue_BytesValue{BytesValue: bv} +} + // copyTo copies the value to Value. Will panic if dest is nil. func (v Value) copyTo(dest *otlpcommon.AnyValue) { switch ov := v.orig.Value.(type) { @@ -709,12 +728,23 @@ func (m Map) InsertBool(k string, v bool) { // No action is applied to the map where the key already exists. // The caller must ensure the []byte passed in is not modified after the call is made, sharing the data // across multiple attributes is forbidden. +// Deprecated: [0.51.0] Use InsertMBytes instead. func (m Map) InsertBytes(k string, v []byte) { if _, existing := m.Get(k); !existing { *m.orig = append(*m.orig, newAttributeKeyValueBytes(k, v)) } } +// InsertMBytes adds the []byte Value to the map when the key does not exist. +// No action is applied to the map where the key already exists. +// The caller must ensure the []byte passed in is not modified after the call is made, sharing the data +// across multiple attributes is forbidden. +func (m Map) InsertMBytes(k string, v []byte) { + if _, existing := m.Get(k); !existing { + *m.orig = append(*m.orig, newAttributeKeyValueBytes(k, v)) + } +} + // Update updates an existing Value with a value. // No action is applied to the map where the key does not exist. // @@ -764,9 +794,20 @@ func (m Map) UpdateBool(k string, v bool) { // No action is applied to the map where the key does not exist. // The caller must ensure the []byte passed in is not modified after the call is made, sharing the data // across multiple attributes is forbidden. +// Deprecated: [0.51.0] Use UpdateMBytes instead. func (m Map) UpdateBytes(k string, v []byte) { if av, existing := m.Get(k); existing { - av.SetBytesVal(v) + av.SetMBytesVal(v) + } +} + +// UpdateMBytes updates an existing []byte Value with a value. +// No action is applied to the map where the key does not exist. +// The caller must ensure the []byte passed in is not modified after the call is made, sharing the data +// across multiple attributes is forbidden. +func (m Map) UpdateMBytes(k string, v []byte) { + if av, existing := m.Get(k); existing { + av.SetMBytesVal(v) } } @@ -835,9 +876,23 @@ func (m Map) UpsertBool(k string, v bool) { // updated to the map where the key already existed. // The caller must ensure the []byte passed in is not modified after the call is made, sharing the data // across multiple attributes is forbidden. +// Deprecated: [0.51.0] Use UpsertMBytes instead. func (m Map) UpsertBytes(k string, v []byte) { if av, existing := m.Get(k); existing { - av.SetBytesVal(v) + av.SetMBytesVal(v) + } else { + *m.orig = append(*m.orig, newAttributeKeyValueBytes(k, v)) + } +} + +// UpsertMBytes performs the Insert or Update action. The []byte Value is +// inserted to the map that did not originally have the key. The key/value is +// updated to the map where the key already existed. +// The caller must ensure the []byte passed in is not modified after the call is made, sharing the data +// across multiple attributes is forbidden. +func (m Map) UpsertMBytes(k string, v []byte) { + if av, existing := m.Get(k); existing { + av.SetMBytesVal(v) } else { *m.orig = append(*m.orig, newAttributeKeyValueBytes(k, v)) } diff --git a/pdata/internal/common_test.go b/pdata/internal/common_test.go index 73d82d56003..290bff5cbe2 100644 --- a/pdata/internal/common_test.go +++ b/pdata/internal/common_test.go @@ -298,7 +298,7 @@ func TestNilMap(t *testing.T) { assert.EqualValues(t, generateTestBoolMap(), insertMapBool) insertMapBytes := NewMap() - insertMapBytes.InsertBytes("k", []byte{1, 2, 3, 4, 5}) + insertMapBytes.InsertMBytes("k", []byte{1, 2, 3, 4, 5}) assert.EqualValues(t, generateTestBytesMap(), insertMapBytes) updateMap := NewMap() @@ -322,7 +322,7 @@ func TestNilMap(t *testing.T) { assert.EqualValues(t, NewMap(), updateMapBool) updateMapBytes := NewMap() - updateMapBytes.UpdateBytes("k", []byte{1, 2, 3}) + updateMapBytes.UpdateMBytes("k", []byte{1, 2, 3}) assert.EqualValues(t, NewMap(), updateMapBytes) upsertMap := NewMap() @@ -346,7 +346,7 @@ func TestNilMap(t *testing.T) { assert.EqualValues(t, generateTestBoolMap(), upsertMapBool) upsertMapBytes := NewMap() - upsertMapBytes.UpsertBytes("k", []byte{1, 2, 3, 4, 5}) + upsertMapBytes.UpsertMBytes("k", []byte{1, 2, 3, 4, 5}) assert.EqualValues(t, generateTestBytesMap(), upsertMapBytes) removeMap := NewMap() @@ -412,7 +412,7 @@ func TestMapWithEmpty(t *testing.T) { assert.EqualValues(t, ValueTypeBool, val.Type()) assert.True(t, val.BoolVal()) - sm.InsertBytes("other_key_bytes", []byte{1, 2, 3}) + sm.InsertMBytes("other_key_bytes", []byte{1, 2, 3}) val, exist = sm.Get("other_key_bytes") assert.True(t, exist) assert.EqualValues(t, ValueTypeBytes, val.Type()) @@ -448,7 +448,7 @@ func TestMapWithEmpty(t *testing.T) { assert.EqualValues(t, ValueTypeBool, val.Type()) assert.False(t, val.BoolVal()) - sm.UpdateBytes("other_key_bytes", []byte{4, 5, 6}) + sm.UpdateMBytes("other_key_bytes", []byte{4, 5, 6}) val, exist = sm.Get("other_key_bytes") assert.True(t, exist) assert.EqualValues(t, ValueTypeBytes, val.Type()) @@ -484,7 +484,7 @@ func TestMapWithEmpty(t *testing.T) { assert.EqualValues(t, ValueTypeBool, val.Type()) assert.True(t, val.BoolVal()) - sm.UpsertBytes("other_key_bytes", []byte{7, 8, 9}) + sm.UpsertMBytes("other_key_bytes", []byte{7, 8, 9}) val, exist = sm.Get("other_key_bytes") assert.True(t, exist) assert.EqualValues(t, ValueTypeBytes, val.Type()) @@ -520,7 +520,7 @@ func TestMapWithEmpty(t *testing.T) { assert.EqualValues(t, ValueTypeBool, val.Type()) assert.False(t, val.BoolVal()) - sm.UpsertBytes("yet_another_key_bytes", []byte{1}) + sm.UpsertMBytes("yet_another_key_bytes", []byte{1}) val, exist = sm.Get("yet_another_key_bytes") assert.True(t, exist) assert.EqualValues(t, ValueTypeBytes, val.Type()) diff --git a/pdata/internal/generated_pmetric.go b/pdata/internal/generated_pmetric.go index 4e4a4df13e4..7806df195ac 100644 --- a/pdata/internal/generated_pmetric.go +++ b/pdata/internal/generated_pmetric.go @@ -1444,23 +1444,23 @@ func (ms HistogramDataPoint) SetSum(v float64) { (*ms.orig).Sum_ = &otlpmetrics.HistogramDataPoint_Sum{Sum: v} } -// BucketCounts returns the bucketcounts associated with this HistogramDataPoint. -func (ms HistogramDataPoint) BucketCounts() []uint64 { +// MBucketCounts returns the mbucketcounts associated with this HistogramDataPoint. +func (ms HistogramDataPoint) MBucketCounts() []uint64 { return (*ms.orig).BucketCounts } -// SetBucketCounts replaces the bucketcounts associated with this HistogramDataPoint. -func (ms HistogramDataPoint) SetBucketCounts(v []uint64) { +// SetMBucketCounts replaces the mbucketcounts associated with this HistogramDataPoint. +func (ms HistogramDataPoint) SetMBucketCounts(v []uint64) { (*ms.orig).BucketCounts = v } -// ExplicitBounds returns the explicitbounds associated with this HistogramDataPoint. -func (ms HistogramDataPoint) ExplicitBounds() []float64 { +// MExplicitBounds returns the mexplicitbounds associated with this HistogramDataPoint. +func (ms HistogramDataPoint) MExplicitBounds() []float64 { return (*ms.orig).ExplicitBounds } -// SetExplicitBounds replaces the explicitbounds associated with this HistogramDataPoint. -func (ms HistogramDataPoint) SetExplicitBounds(v []float64) { +// SetMExplicitBounds replaces the mexplicitbounds associated with this HistogramDataPoint. +func (ms HistogramDataPoint) SetMExplicitBounds(v []float64) { (*ms.orig).ExplicitBounds = v } @@ -1822,13 +1822,13 @@ func (ms Buckets) SetOffset(v int32) { (*ms.orig).Offset = int32(v) } -// BucketCounts returns the bucketcounts associated with this Buckets. -func (ms Buckets) BucketCounts() []uint64 { +// MBucketCounts returns the mbucketcounts associated with this Buckets. +func (ms Buckets) MBucketCounts() []uint64 { return (*ms.orig).BucketCounts } -// SetBucketCounts replaces the bucketcounts associated with this Buckets. -func (ms Buckets) SetBucketCounts(v []uint64) { +// SetMBucketCounts replaces the mbucketcounts associated with this Buckets. +func (ms Buckets) SetMBucketCounts(v []uint64) { (*ms.orig).BucketCounts = v } diff --git a/pdata/internal/generated_pmetric_test.go b/pdata/internal/generated_pmetric_test.go index a457d7cef25..c0706d647be 100644 --- a/pdata/internal/generated_pmetric_test.go +++ b/pdata/internal/generated_pmetric_test.go @@ -1065,13 +1065,13 @@ func TestHistogramDataPoint_CopyTo(t *testing.T) { orig = generateTestHistogramDataPoint() orig.CopyTo(ms) assert.EqualValues(t, orig, ms) - orig.BucketCounts()[0] = 0 + orig.MBucketCounts()[0] = 0 assert.NotEqualValues(t, orig, ms) - orig.BucketCounts()[0] = []uint64{1, 2, 3}[0] + orig.MBucketCounts()[0] = []uint64{1, 2, 3}[0] assert.EqualValues(t, orig, ms) - orig.ExplicitBounds()[0] = 0 + orig.MExplicitBounds()[0] = 0 assert.NotEqualValues(t, orig, ms) - orig.ExplicitBounds()[0] = []float64{1, 2, 3}[0] + orig.MExplicitBounds()[0] = []float64{1, 2, 3}[0] assert.EqualValues(t, orig, ms) } @@ -1115,20 +1115,20 @@ func TestHistogramDataPoint_Sum(t *testing.T) { assert.EqualValues(t, testValSum, ms.Sum()) } -func TestHistogramDataPoint_BucketCounts(t *testing.T) { +func TestHistogramDataPoint_MBucketCounts(t *testing.T) { ms := NewHistogramDataPoint() - assert.EqualValues(t, []uint64(nil), ms.BucketCounts()) - testValBucketCounts := []uint64{1, 2, 3} - ms.SetBucketCounts(testValBucketCounts) - assert.EqualValues(t, testValBucketCounts, ms.BucketCounts()) + assert.EqualValues(t, []uint64(nil), ms.MBucketCounts()) + testValMBucketCounts := []uint64{1, 2, 3} + ms.SetMBucketCounts(testValMBucketCounts) + assert.EqualValues(t, testValMBucketCounts, ms.MBucketCounts()) } -func TestHistogramDataPoint_ExplicitBounds(t *testing.T) { +func TestHistogramDataPoint_MExplicitBounds(t *testing.T) { ms := NewHistogramDataPoint() - assert.EqualValues(t, []float64(nil), ms.ExplicitBounds()) - testValExplicitBounds := []float64{1, 2, 3} - ms.SetExplicitBounds(testValExplicitBounds) - assert.EqualValues(t, testValExplicitBounds, ms.ExplicitBounds()) + assert.EqualValues(t, []float64(nil), ms.MExplicitBounds()) + testValMExplicitBounds := []float64{1, 2, 3} + ms.SetMExplicitBounds(testValMExplicitBounds) + assert.EqualValues(t, testValMExplicitBounds, ms.MExplicitBounds()) } func TestHistogramDataPoint_Exemplars(t *testing.T) { @@ -1375,9 +1375,9 @@ func TestBuckets_CopyTo(t *testing.T) { orig = generateTestBuckets() orig.CopyTo(ms) assert.EqualValues(t, orig, ms) - orig.BucketCounts()[0] = 0 + orig.MBucketCounts()[0] = 0 assert.NotEqualValues(t, orig, ms) - orig.BucketCounts()[0] = []uint64{1, 2, 3}[0] + orig.MBucketCounts()[0] = []uint64{1, 2, 3}[0] assert.EqualValues(t, orig, ms) } @@ -1389,12 +1389,12 @@ func TestBuckets_Offset(t *testing.T) { assert.EqualValues(t, testValOffset, ms.Offset()) } -func TestBuckets_BucketCounts(t *testing.T) { +func TestBuckets_MBucketCounts(t *testing.T) { ms := NewBuckets() - assert.EqualValues(t, []uint64(nil), ms.BucketCounts()) - testValBucketCounts := []uint64{1, 2, 3} - ms.SetBucketCounts(testValBucketCounts) - assert.EqualValues(t, testValBucketCounts, ms.BucketCounts()) + assert.EqualValues(t, []uint64(nil), ms.MBucketCounts()) + testValMBucketCounts := []uint64{1, 2, 3} + ms.SetMBucketCounts(testValMBucketCounts) + assert.EqualValues(t, testValMBucketCounts, ms.MBucketCounts()) } func TestSummaryDataPointSlice(t *testing.T) { @@ -2091,8 +2091,8 @@ func fillTestHistogramDataPoint(tv HistogramDataPoint) { tv.SetTimestamp(Timestamp(1234567890)) tv.SetCount(uint64(17)) tv.SetSum(float64(17.13)) - tv.SetBucketCounts([]uint64{1, 2, 3}) - tv.SetExplicitBounds([]float64{1, 2, 3}) + tv.SetMBucketCounts([]uint64{1, 2, 3}) + tv.SetMExplicitBounds([]float64{1, 2, 3}) fillTestExemplarSlice(tv.Exemplars()) tv.SetFlags(MetricDataPointFlagsNone) } @@ -2139,7 +2139,7 @@ func generateTestBuckets() Buckets { func fillTestBuckets(tv Buckets) { tv.SetOffset(int32(909)) - tv.SetBucketCounts([]uint64{1, 2, 3}) + tv.SetMBucketCounts([]uint64{1, 2, 3}) } func generateTestSummaryDataPointSlice() SummaryDataPointSlice { diff --git a/pdata/internal/metrics.go b/pdata/internal/metrics.go index 1a032c0f716..75bbc39a384 100644 --- a/pdata/internal/metrics.go +++ b/pdata/internal/metrics.go @@ -284,3 +284,39 @@ func (ot OptionalType) String() string { } return "" } + +// BucketCounts returns the bucketcounts associated with this HistogramDataPoint. +// Deprecated: [0.51.0] Use MBucketCounts instead. +func (ms HistogramDataPoint) BucketCounts() []uint64 { + return ms.orig.BucketCounts +} + +// SetBucketCounts replaces the bucketcounts associated with this HistogramDataPoint. +// Deprecated: [0.51.0] Use SetMBucketCounts instead. +func (ms HistogramDataPoint) SetBucketCounts(v []uint64) { + ms.orig.BucketCounts = v +} + +// ExplicitBounds returns the explicitbounds associated with this HistogramDataPoint. +// Deprecated: [0.51.0] Use MExplicitBounds instead. +func (ms HistogramDataPoint) ExplicitBounds() []float64 { + return ms.orig.ExplicitBounds +} + +// SetExplicitBounds replaces the explicitbounds associated with this HistogramDataPoint. +// Deprecated: [0.51.0] Use SetMExplicitBounds instead. +func (ms HistogramDataPoint) SetExplicitBounds(v []float64) { + ms.orig.ExplicitBounds = v +} + +// BucketCounts returns the bucketcounts associated with this Buckets. +// Deprecated: [0.51.0] Use MBucketCounts instead. +func (ms Buckets) BucketCounts() []uint64 { + return ms.orig.BucketCounts +} + +// SetBucketCounts replaces the bucketcounts associated with this Buckets. +// Deprecated: [0.51.0] Use SetMBucketCounts instead. +func (ms Buckets) SetBucketCounts(v []uint64) { + ms.orig.BucketCounts = v +} diff --git a/pdata/internal/metrics_test.go b/pdata/internal/metrics_test.go index cbc6504d71a..01503603301 100644 --- a/pdata/internal/metrics_test.go +++ b/pdata/internal/metrics_test.go @@ -310,15 +310,15 @@ func TestOtlpToInternalReadOnly(t *testing.T) { // First point assert.EqualValues(t, startTime, histogramDataPoints.At(0).StartTimestamp()) assert.EqualValues(t, endTime, histogramDataPoints.At(0).Timestamp()) - assert.EqualValues(t, []float64{1, 2}, histogramDataPoints.At(0).ExplicitBounds()) + assert.EqualValues(t, []float64{1, 2}, histogramDataPoints.At(0).MExplicitBounds()) assert.EqualValues(t, NewMapFromRaw(map[string]interface{}{"key0": "value0"}), histogramDataPoints.At(0).Attributes()) - assert.EqualValues(t, []uint64{10, 15, 1}, histogramDataPoints.At(0).BucketCounts()) + assert.EqualValues(t, []uint64{10, 15, 1}, histogramDataPoints.At(0).MBucketCounts()) // Second point assert.EqualValues(t, startTime, histogramDataPoints.At(1).StartTimestamp()) assert.EqualValues(t, endTime, histogramDataPoints.At(1).Timestamp()) - assert.EqualValues(t, []float64{1}, histogramDataPoints.At(1).ExplicitBounds()) + assert.EqualValues(t, []float64{1}, histogramDataPoints.At(1).MExplicitBounds()) assert.EqualValues(t, NewMapFromRaw(map[string]interface{}{"key1": "value1"}), histogramDataPoints.At(1).Attributes()) - assert.EqualValues(t, []uint64{10, 1}, histogramDataPoints.At(1).BucketCounts()) + assert.EqualValues(t, []uint64{10, 1}, histogramDataPoints.At(1).MBucketCounts()) } func TestOtlpToFromInternalReadOnly(t *testing.T) { @@ -559,9 +559,9 @@ func TestOtlpToFromInternalHistogramMutating(t *testing.T) { histogramDataPoints.At(0).Attributes().Remove("key0") histogramDataPoints.At(0).Attributes().UpsertString("k", "v") assert.EqualValues(t, newAttributes, histogramDataPoints.At(0).Attributes()) - histogramDataPoints.At(0).SetExplicitBounds([]float64{1}) - assert.EqualValues(t, []float64{1}, histogramDataPoints.At(0).ExplicitBounds()) - histogramDataPoints.At(0).SetBucketCounts([]uint64{21, 32}) + histogramDataPoints.At(0).SetMExplicitBounds([]float64{1}) + assert.EqualValues(t, []float64{1}, histogramDataPoints.At(0).MExplicitBounds()) + histogramDataPoints.At(0).SetMBucketCounts([]uint64{21, 32}) // Test that everything is updated. assert.EqualValues(t, &otlpmetrics.MetricsData{ ResourceMetrics: []*otlpmetrics.ResourceMetrics{ diff --git a/pdata/plog/plogotlp/logs.go b/pdata/plog/plogotlp/logs.go index 31ac5024c45..822370c2273 100644 --- a/pdata/plog/plogotlp/logs.go +++ b/pdata/plog/plogotlp/logs.go @@ -114,11 +114,6 @@ func (lr Request) UnmarshalJSON(data []byte) error { return nil } -// Deprecated: [v0.50.0] Use NewRequestFromLogs instead. -func (lr Request) SetLogs(ld plog.Logs) { - *lr.orig = *internal.LogsToOtlp(ld) -} - func (lr Request) Logs() plog.Logs { return internal.LogsFromOtlp(lr.orig) } diff --git a/pdata/pmetric/alias.go b/pdata/pmetric/alias.go index 527cee57d5f..340db69a0f1 100644 --- a/pdata/pmetric/alias.go +++ b/pdata/pmetric/alias.go @@ -73,21 +73,6 @@ const ( MetricDataPointFlagNoRecordedValue = internal.MetricDataPointFlagNoRecordedValue ) -// MetricValueType specifies the type of NumberDataPoint. -// Deprecated: [v0.50.0] Use NumberDataPointValueType or ExemplarValueType instead. -type MetricValueType = internal.NumberDataPointValueType - -const ( - // Deprecated: [v0.50.0] Use NumberDataPointValueTypeNone instead. - MetricValueTypeNone = internal.NumberDataPointValueTypeNone - - // Deprecated: [v0.50.0] Use NumberDataPointValueTypeInt. - MetricValueTypeInt = internal.NumberDataPointValueTypeInt - - // Deprecated: [v0.50.0] Use NumberDataPointValueTypeDouble instead. - MetricValueTypeDouble = internal.NumberDataPointValueTypeDouble -) - // NumberDataPointValueType specifies the type of NumberDataPoint value. type NumberDataPointValueType = internal.NumberDataPointValueType diff --git a/pdata/pmetric/pmetricotlp/metrics.go b/pdata/pmetric/pmetricotlp/metrics.go index 5f82610fd04..7499e6e185c 100644 --- a/pdata/pmetric/pmetricotlp/metrics.go +++ b/pdata/pmetric/pmetricotlp/metrics.go @@ -110,11 +110,6 @@ func (mr Request) UnmarshalJSON(data []byte) error { return nil } -// Deprecated: [v0.50.0] Use NewRequestFromMetrics instead. -func (mr Request) SetMetrics(ld pmetric.Metrics) { - *mr.orig = *internal.MetricsToOtlp(ld) -} - func (mr Request) Metrics() pmetric.Metrics { return internal.MetricsFromOtlp(mr.orig) } diff --git a/pdata/ptrace/json_test.go b/pdata/ptrace/json_test.go index b02a10828ca..bfa2651bee3 100644 --- a/pdata/ptrace/json_test.go +++ b/pdata/ptrace/json_test.go @@ -95,7 +95,7 @@ var tracesOTLPFull = func() Traces { sp.Attributes().UpsertBool("bool", true) sp.Attributes().UpsertInt("int", 1) sp.Attributes().UpsertDouble("double", 1.1) - sp.Attributes().UpsertBytes("bytes", []byte("foo")) + sp.Attributes().UpsertMBytes("bytes", []byte("foo")) arr := internal.NewValueSlice() arr.SliceVal().AppendEmpty().SetIntVal(1) arr.SliceVal().AppendEmpty().SetStringVal("str") @@ -113,7 +113,7 @@ var tracesOTLPFull = func() Traces { event.Attributes().UpsertBool("bool", true) event.Attributes().UpsertInt("int", 1) event.Attributes().UpsertDouble("double", 1.1) - event.Attributes().UpsertBytes("bytes", []byte("foo")) + event.Attributes().UpsertMBytes("bytes", []byte("foo")) // Add links. link := sp.Links().AppendEmpty() link.SetTraceState("state") @@ -124,7 +124,7 @@ var tracesOTLPFull = func() Traces { link.Attributes().UpsertBool("bool", true) link.Attributes().UpsertInt("int", 1) link.Attributes().UpsertDouble("double", 1.1) - link.Attributes().UpsertBytes("bytes", []byte("foo")) + link.Attributes().UpsertMBytes("bytes", []byte("foo")) // Add another span. sp2 := il.Spans().AppendEmpty() sp2.SetName("testSpan2") diff --git a/pdata/ptrace/ptraceotlp/traces.go b/pdata/ptrace/ptraceotlp/traces.go index 1bdfa53a56d..16884555d01 100644 --- a/pdata/ptrace/ptraceotlp/traces.go +++ b/pdata/ptrace/ptraceotlp/traces.go @@ -114,11 +114,6 @@ func (tr Request) UnmarshalJSON(data []byte) error { return nil } -// Deprecated: [v0.50.0] Use NewRequestFromTraces instead. -func (tr Request) SetTraces(td ptrace.Traces) { - *tr.orig = *internal.TracesToOtlp(td) -} - func (tr Request) Traces() ptrace.Traces { return internal.TracesFromOtlp(tr.orig) } diff --git a/service/collector.go b/service/collector.go index 9bd94fcb7d2..06b7ab879ce 100644 --- a/service/collector.go +++ b/service/collector.go @@ -25,7 +25,6 @@ import ( "runtime" "syscall" - "go.opentelemetry.io/contrib/zpages" "go.opentelemetry.io/otel/metric/nonrecording" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/trace" @@ -76,9 +75,8 @@ func (s State) String() string { // Collector represents a server providing the OpenTelemetry Collector service. type Collector struct { - set CollectorSettings - telemetry component.TelemetrySettings - zPagesSpanProcessor *zpages.SpanProcessor + set CollectorSettings + telemetry component.TelemetrySettings service *service state *atomic.Int32 @@ -210,12 +208,11 @@ func (col *Collector) setupConfigurationComponents(ctx context.Context) error { } col.service, err = newService(&svcSettings{ - BuildInfo: col.set.BuildInfo, - Factories: col.set.Factories, - Config: cfg, - Telemetry: col.telemetry, - ZPagesSpanProcessor: col.zPagesSpanProcessor, - AsyncErrorChannel: col.asyncErrorChannel, + BuildInfo: col.set.BuildInfo, + Factories: col.set.Factories, + Config: cfg, + Telemetry: col.telemetry, + AsyncErrorChannel: col.asyncErrorChannel, }) if err != nil { return err @@ -238,10 +235,10 @@ func (col *Collector) setupConfigurationComponents(ctx context.Context) error { // Run starts the collector according to the given configuration given, and waits for it to complete. // Consecutive calls to Run are not allowed, Run shouldn't be called once a collector is shut down. func (col *Collector) Run(ctx context.Context) error { - col.zPagesSpanProcessor = zpages.NewSpanProcessor() col.telemetry.TracerProvider = sdktrace.NewTracerProvider( + // needed for supporting the zpages extension sdktrace.WithSampler(internal.AlwaysRecord()), - sdktrace.WithSpanProcessor(col.zPagesSpanProcessor)) + ) if err := col.setupConfigurationComponents(ctx); err != nil { col.setCollectorState(Closed) diff --git a/service/config_provider.go b/service/config_provider.go index 48c4b2b9a8f..1e2b6e27858 100644 --- a/service/config_provider.go +++ b/service/config_provider.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/collector/config/mapprovider/envmapprovider" "go.opentelemetry.io/collector/config/mapprovider/filemapprovider" "go.opentelemetry.io/collector/config/mapprovider/yamlmapprovider" - "go.opentelemetry.io/collector/internal/configunmarshaler" + "go.opentelemetry.io/collector/service/internal/configunmarshaler" ) // ConfigProvider provides the service configuration. @@ -62,8 +62,7 @@ type ConfigProvider interface { } type configProvider struct { - mapResolver *mapResolver - configUnmarshaler configunmarshaler.ConfigUnmarshaler + mapResolver *mapResolver } // ConfigProviderSettings are the settings to configure the behavior of the ConfigProvider. @@ -78,11 +77,6 @@ type ConfigProviderSettings struct { // MapConverters is a slice of config.MapConverterFunc. MapConverters []config.MapConverterFunc - - // Deprecated: [v0.50.0] because providing custom ConfigUnmarshaler is not necessary since users can wrap/implement - // ConfigProvider if needed to change the resulted config. This functionality will be kept for at least 2 minor versions, - // and if nobody express a need for it will be removed. - Unmarshaler configunmarshaler.ConfigUnmarshaler } func newDefaultConfigProviderSettings(locations []string) ConfigProviderSettings { @@ -90,7 +84,6 @@ func newDefaultConfigProviderSettings(locations []string) ConfigProviderSettings Locations: locations, MapProviders: makeMapProvidersMap(filemapprovider.New(), envmapprovider.New(), yamlmapprovider.New()), MapConverters: []config.MapConverterFunc{expandmapconverter.New()}, - Unmarshaler: configunmarshaler.NewDefault(), } } @@ -105,14 +98,8 @@ func NewConfigProvider(set ConfigProviderSettings) (ConfigProvider, error) { return nil, err } - unmarshaler := set.Unmarshaler - if unmarshaler == nil { - unmarshaler = configunmarshaler.NewDefault() - } - return &configProvider{ - mapResolver: mr, - configUnmarshaler: unmarshaler, + mapResolver: mr, }, nil } @@ -123,7 +110,7 @@ func (cm *configProvider) Get(ctx context.Context, factories component.Factories } var cfg *config.Config - if cfg, err = cm.configUnmarshaler.Unmarshal(retMap, factories); err != nil { + if cfg, err = configunmarshaler.New().Unmarshal(retMap, factories); err != nil { return nil, fmt.Errorf("cannot unmarshal the configuration: %w", err) } diff --git a/service/config_provider_test.go b/service/config_provider_test.go index ae75236e788..afb4b4f9f7b 100644 --- a/service/config_provider_test.go +++ b/service/config_provider_test.go @@ -16,48 +16,20 @@ package service import ( "context" - "errors" "path/filepath" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" - "go.opentelemetry.io/collector/config" ) -type errConfigUnmarshaler struct { - err error -} - -func (ecu *errConfigUnmarshaler) Unmarshal(*config.Map, component.Factories) (*config.Config, error) { - return nil, ecu.err -} - -func TestConfigProviderUnmarshalError(t *testing.T) { - factories, errF := componenttest.NopFactories() - require.NoError(t, errF) - - set := newDefaultConfigProviderSettings([]string{filepath.Join("testdata", "otelcol-nop.yaml")}) - set.Unmarshaler = &errConfigUnmarshaler{err: errors.New("unmarshal_err")} - - cfgW, err := NewConfigProvider(set) - assert.NoError(t, err) - - _, err = cfgW.Get(context.Background(), factories) - assert.Error(t, err) - - assert.NoError(t, cfgW.Shutdown(context.Background())) -} - func TestConfigProviderValidationError(t *testing.T) { factories, errF := componenttest.NopFactories() require.NoError(t, errF) set := newDefaultConfigProviderSettings([]string{filepath.Join("testdata", "otelcol-invalid.yaml")}) - set.Unmarshaler = &errConfigUnmarshaler{err: errors.New("unmarshal_err")} cfgW, err := NewConfigProvider(set) assert.NoError(t, err) diff --git a/service/featuregate/gates.go b/service/featuregate/gates.go index 68869aac897..3cde777de5b 100644 --- a/service/featuregate/gates.go +++ b/service/featuregate/gates.go @@ -34,18 +34,6 @@ func GetRegistry() *Registry { return reg } -// Deprecated: [v0.50.0] Use GetRegistry().Apply. -var Apply = GetRegistry().Apply - -// Deprecated: [v0.50.0] Use GetRegistry().IsEnabled. -var IsEnabled = GetRegistry().IsEnabled - -// Deprecated: [v0.50.0] Use GetRegistry().List. -var List = GetRegistry().List - -// Deprecated: [v0.50.0] Use GetRegistry().MustRegister. -var Register = GetRegistry().MustRegister - // NewRegistry returns a new empty Registry. func NewRegistry() *Registry { return &Registry{gates: make(map[string]Gate)} diff --git a/service/host.go b/service/host.go index 5767b7e4b63..58d92f3be48 100644 --- a/service/host.go +++ b/service/host.go @@ -15,8 +15,6 @@ package service // import "go.opentelemetry.io/collector/service" import ( - "go.opentelemetry.io/contrib/zpages" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/service/internal/builder" @@ -26,9 +24,8 @@ import ( var _ component.Host = (*serviceHost)(nil) type serviceHost struct { - asyncErrorChannel chan error - factories component.Factories - zPagesSpanProcessor *zpages.SpanProcessor + asyncErrorChannel chan error + factories component.Factories builtExporters builder.Exporters builtReceivers builder.Receivers diff --git a/internal/configunmarshaler/defaultunmarshaler.go b/service/internal/configunmarshaler/defaultunmarshaler.go similarity index 93% rename from internal/configunmarshaler/defaultunmarshaler.go rename to service/internal/configunmarshaler/defaultunmarshaler.go index 4de43165c3d..3e75f59d181 100644 --- a/internal/configunmarshaler/defaultunmarshaler.go +++ b/service/internal/configunmarshaler/defaultunmarshaler.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package configunmarshaler // import "go.opentelemetry.io/collector/internal/configunmarshaler" +package configunmarshaler // import "go.opentelemetry.io/collector/service/internal/configunmarshaler" import ( "fmt" @@ -25,12 +25,6 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -// ConfigUnmarshaler is the interface that unmarshalls the collector configuration from the config.Map. -type ConfigUnmarshaler interface { - // Unmarshal the configuration from the given parser and factories. - Unmarshal(v *config.Map, factories component.Factories) (*config.Config, error) -} - // These are errors that can be returned by Unmarshal(). Note that error codes are not part // of Unmarshal()'s public API, they are for internal unit testing only. type configErrorCode int @@ -81,17 +75,17 @@ type configSettings struct { Service map[string]interface{} `mapstructure:"service"` } -type defaultUnmarshaler struct{} +type ConfigUnmarshaler struct{} -// NewDefault returns a default ConfigUnmarshaler that unmarshalls every configuration -// using the custom unmarshaler if present or default to strict -func NewDefault() ConfigUnmarshaler { - return &defaultUnmarshaler{} +// New returns a default ConfigUnmarshaler that unmarshalls every component's configuration +// using the custom unmarshaler if present or default strict unmarshaler otherwise. +func New() ConfigUnmarshaler { + return ConfigUnmarshaler{} } -// Unmarshal the Config from a config.Map. +// Unmarshal the config.Config from a config.Map. // After the config is unmarshalled, `Validate()` must be called to validate. -func (*defaultUnmarshaler) Unmarshal(v *config.Map, factories component.Factories) (*config.Config, error) { +func (ConfigUnmarshaler) Unmarshal(v *config.Map, factories component.Factories) (*config.Config, error) { var cfg config.Config // Unmarshal top level sections and validate. diff --git a/internal/configunmarshaler/defaultunmarshaler_test.go b/service/internal/configunmarshaler/defaultunmarshaler_test.go similarity index 99% rename from internal/configunmarshaler/defaultunmarshaler_test.go rename to service/internal/configunmarshaler/defaultunmarshaler_test.go index 55a6d8c8071..17cacd228ae 100644 --- a/internal/configunmarshaler/defaultunmarshaler_test.go +++ b/service/internal/configunmarshaler/defaultunmarshaler_test.go @@ -230,7 +230,7 @@ func loadConfigFile(t *testing.T, fileName string, factories component.Factories require.NoError(t, err) // Unmarshal the config from the config.Map using the given factories. - return NewDefault().Unmarshal(cm, factories) + return New().Unmarshal(cm, factories) } func TestDefaultLoggerConfig(t *testing.T) { diff --git a/internal/configunmarshaler/testdata/duplicate-exporter.yaml b/service/internal/configunmarshaler/testdata/duplicate-exporter.yaml similarity index 100% rename from internal/configunmarshaler/testdata/duplicate-exporter.yaml rename to service/internal/configunmarshaler/testdata/duplicate-exporter.yaml diff --git a/internal/configunmarshaler/testdata/duplicate-extension.yaml b/service/internal/configunmarshaler/testdata/duplicate-extension.yaml similarity index 100% rename from internal/configunmarshaler/testdata/duplicate-extension.yaml rename to service/internal/configunmarshaler/testdata/duplicate-extension.yaml diff --git a/internal/configunmarshaler/testdata/duplicate-pipeline.yaml b/service/internal/configunmarshaler/testdata/duplicate-pipeline.yaml similarity index 100% rename from internal/configunmarshaler/testdata/duplicate-pipeline.yaml rename to service/internal/configunmarshaler/testdata/duplicate-pipeline.yaml diff --git a/internal/configunmarshaler/testdata/duplicate-processor.yaml b/service/internal/configunmarshaler/testdata/duplicate-processor.yaml similarity index 100% rename from internal/configunmarshaler/testdata/duplicate-processor.yaml rename to service/internal/configunmarshaler/testdata/duplicate-processor.yaml diff --git a/internal/configunmarshaler/testdata/duplicate-receiver.yaml b/service/internal/configunmarshaler/testdata/duplicate-receiver.yaml similarity index 100% rename from internal/configunmarshaler/testdata/duplicate-receiver.yaml rename to service/internal/configunmarshaler/testdata/duplicate-receiver.yaml diff --git a/internal/configunmarshaler/testdata/empty-all-sections.yaml b/service/internal/configunmarshaler/testdata/empty-all-sections.yaml similarity index 100% rename from internal/configunmarshaler/testdata/empty-all-sections.yaml rename to service/internal/configunmarshaler/testdata/empty-all-sections.yaml diff --git a/internal/configunmarshaler/testdata/empty-config.yaml b/service/internal/configunmarshaler/testdata/empty-config.yaml similarity index 100% rename from internal/configunmarshaler/testdata/empty-config.yaml rename to service/internal/configunmarshaler/testdata/empty-config.yaml diff --git a/internal/configunmarshaler/testdata/invalid-exporter-name-after-slash.yaml b/service/internal/configunmarshaler/testdata/invalid-exporter-name-after-slash.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-exporter-name-after-slash.yaml rename to service/internal/configunmarshaler/testdata/invalid-exporter-name-after-slash.yaml diff --git a/internal/configunmarshaler/testdata/invalid-exporter-section.yaml b/service/internal/configunmarshaler/testdata/invalid-exporter-section.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-exporter-section.yaml rename to service/internal/configunmarshaler/testdata/invalid-exporter-section.yaml diff --git a/internal/configunmarshaler/testdata/invalid-exporter-sub-config.yaml b/service/internal/configunmarshaler/testdata/invalid-exporter-sub-config.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-exporter-sub-config.yaml rename to service/internal/configunmarshaler/testdata/invalid-exporter-sub-config.yaml diff --git a/internal/configunmarshaler/testdata/invalid-exporter-type.yaml b/service/internal/configunmarshaler/testdata/invalid-exporter-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-exporter-type.yaml rename to service/internal/configunmarshaler/testdata/invalid-exporter-type.yaml diff --git a/internal/configunmarshaler/testdata/invalid-extension-name-after-slash.yaml b/service/internal/configunmarshaler/testdata/invalid-extension-name-after-slash.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-extension-name-after-slash.yaml rename to service/internal/configunmarshaler/testdata/invalid-extension-name-after-slash.yaml diff --git a/internal/configunmarshaler/testdata/invalid-extension-section.yaml b/service/internal/configunmarshaler/testdata/invalid-extension-section.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-extension-section.yaml rename to service/internal/configunmarshaler/testdata/invalid-extension-section.yaml diff --git a/internal/configunmarshaler/testdata/invalid-extension-sub-config.yaml b/service/internal/configunmarshaler/testdata/invalid-extension-sub-config.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-extension-sub-config.yaml rename to service/internal/configunmarshaler/testdata/invalid-extension-sub-config.yaml diff --git a/internal/configunmarshaler/testdata/invalid-extension-type.yaml b/service/internal/configunmarshaler/testdata/invalid-extension-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-extension-type.yaml rename to service/internal/configunmarshaler/testdata/invalid-extension-type.yaml diff --git a/internal/configunmarshaler/testdata/invalid-logs-level.yaml b/service/internal/configunmarshaler/testdata/invalid-logs-level.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-logs-level.yaml rename to service/internal/configunmarshaler/testdata/invalid-logs-level.yaml diff --git a/internal/configunmarshaler/testdata/invalid-metrics-level.yaml b/service/internal/configunmarshaler/testdata/invalid-metrics-level.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-metrics-level.yaml rename to service/internal/configunmarshaler/testdata/invalid-metrics-level.yaml diff --git a/internal/configunmarshaler/testdata/invalid-pipeline-name-after-slash.yaml b/service/internal/configunmarshaler/testdata/invalid-pipeline-name-after-slash.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-pipeline-name-after-slash.yaml rename to service/internal/configunmarshaler/testdata/invalid-pipeline-name-after-slash.yaml diff --git a/internal/configunmarshaler/testdata/invalid-pipeline-section.yaml b/service/internal/configunmarshaler/testdata/invalid-pipeline-section.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-pipeline-section.yaml rename to service/internal/configunmarshaler/testdata/invalid-pipeline-section.yaml diff --git a/internal/configunmarshaler/testdata/invalid-pipeline-sub-config.yaml b/service/internal/configunmarshaler/testdata/invalid-pipeline-sub-config.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-pipeline-sub-config.yaml rename to service/internal/configunmarshaler/testdata/invalid-pipeline-sub-config.yaml diff --git a/internal/configunmarshaler/testdata/invalid-pipeline-type.yaml b/service/internal/configunmarshaler/testdata/invalid-pipeline-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-pipeline-type.yaml rename to service/internal/configunmarshaler/testdata/invalid-pipeline-type.yaml diff --git a/internal/configunmarshaler/testdata/invalid-processor-name-after-slash.yaml b/service/internal/configunmarshaler/testdata/invalid-processor-name-after-slash.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-processor-name-after-slash.yaml rename to service/internal/configunmarshaler/testdata/invalid-processor-name-after-slash.yaml diff --git a/internal/configunmarshaler/testdata/invalid-processor-section.yaml b/service/internal/configunmarshaler/testdata/invalid-processor-section.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-processor-section.yaml rename to service/internal/configunmarshaler/testdata/invalid-processor-section.yaml diff --git a/internal/configunmarshaler/testdata/invalid-processor-sub-config.yaml b/service/internal/configunmarshaler/testdata/invalid-processor-sub-config.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-processor-sub-config.yaml rename to service/internal/configunmarshaler/testdata/invalid-processor-sub-config.yaml diff --git a/internal/configunmarshaler/testdata/invalid-processor-type.yaml b/service/internal/configunmarshaler/testdata/invalid-processor-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-processor-type.yaml rename to service/internal/configunmarshaler/testdata/invalid-processor-type.yaml diff --git a/internal/configunmarshaler/testdata/invalid-receiver-name-after-slash.yaml b/service/internal/configunmarshaler/testdata/invalid-receiver-name-after-slash.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-receiver-name-after-slash.yaml rename to service/internal/configunmarshaler/testdata/invalid-receiver-name-after-slash.yaml diff --git a/internal/configunmarshaler/testdata/invalid-receiver-section.yaml b/service/internal/configunmarshaler/testdata/invalid-receiver-section.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-receiver-section.yaml rename to service/internal/configunmarshaler/testdata/invalid-receiver-section.yaml diff --git a/internal/configunmarshaler/testdata/invalid-receiver-sub-config.yaml b/service/internal/configunmarshaler/testdata/invalid-receiver-sub-config.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-receiver-sub-config.yaml rename to service/internal/configunmarshaler/testdata/invalid-receiver-sub-config.yaml diff --git a/internal/configunmarshaler/testdata/invalid-receiver-type.yaml b/service/internal/configunmarshaler/testdata/invalid-receiver-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-receiver-type.yaml rename to service/internal/configunmarshaler/testdata/invalid-receiver-type.yaml diff --git a/internal/configunmarshaler/testdata/invalid-sequence-value.yaml b/service/internal/configunmarshaler/testdata/invalid-sequence-value.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-sequence-value.yaml rename to service/internal/configunmarshaler/testdata/invalid-sequence-value.yaml diff --git a/internal/configunmarshaler/testdata/invalid-service-extensions-section.yaml b/service/internal/configunmarshaler/testdata/invalid-service-extensions-section.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-service-extensions-section.yaml rename to service/internal/configunmarshaler/testdata/invalid-service-extensions-section.yaml diff --git a/internal/configunmarshaler/testdata/invalid-service-section.yaml b/service/internal/configunmarshaler/testdata/invalid-service-section.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-service-section.yaml rename to service/internal/configunmarshaler/testdata/invalid-service-section.yaml diff --git a/internal/configunmarshaler/testdata/invalid-top-level-section.yaml b/service/internal/configunmarshaler/testdata/invalid-top-level-section.yaml similarity index 100% rename from internal/configunmarshaler/testdata/invalid-top-level-section.yaml rename to service/internal/configunmarshaler/testdata/invalid-top-level-section.yaml diff --git a/internal/configunmarshaler/testdata/unknown-exporter-type.yaml b/service/internal/configunmarshaler/testdata/unknown-exporter-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/unknown-exporter-type.yaml rename to service/internal/configunmarshaler/testdata/unknown-exporter-type.yaml diff --git a/internal/configunmarshaler/testdata/unknown-extension-type.yaml b/service/internal/configunmarshaler/testdata/unknown-extension-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/unknown-extension-type.yaml rename to service/internal/configunmarshaler/testdata/unknown-extension-type.yaml diff --git a/internal/configunmarshaler/testdata/unknown-pipeline-type.yaml b/service/internal/configunmarshaler/testdata/unknown-pipeline-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/unknown-pipeline-type.yaml rename to service/internal/configunmarshaler/testdata/unknown-pipeline-type.yaml diff --git a/internal/configunmarshaler/testdata/unknown-processor-type.yaml b/service/internal/configunmarshaler/testdata/unknown-processor-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/unknown-processor-type.yaml rename to service/internal/configunmarshaler/testdata/unknown-processor-type.yaml diff --git a/internal/configunmarshaler/testdata/unknown-receiver-type.yaml b/service/internal/configunmarshaler/testdata/unknown-receiver-type.yaml similarity index 100% rename from internal/configunmarshaler/testdata/unknown-receiver-type.yaml rename to service/internal/configunmarshaler/testdata/unknown-receiver-type.yaml diff --git a/internal/configunmarshaler/testdata/valid-config.yaml b/service/internal/configunmarshaler/testdata/valid-config.yaml similarity index 100% rename from internal/configunmarshaler/testdata/valid-config.yaml rename to service/internal/configunmarshaler/testdata/valid-config.yaml diff --git a/service/service.go b/service/service.go index 986e6daa835..9df7477674d 100644 --- a/service/service.go +++ b/service/service.go @@ -40,9 +40,8 @@ func newService(set *svcSettings) (*service, error) { config: set.Config, telemetry: set.Telemetry, host: &serviceHost{ - factories: set.Factories, - zPagesSpanProcessor: set.ZPagesSpanProcessor, - asyncErrorChannel: set.AsyncErrorChannel, + factories: set.Factories, + asyncErrorChannel: set.AsyncErrorChannel, }, } diff --git a/service/servicetest/configprovider.go b/service/servicetest/configprovider.go index 921e8b5c403..1d7196bf59b 100644 --- a/service/servicetest/configprovider.go +++ b/service/servicetest/configprovider.go @@ -18,7 +18,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/config/configtest" - "go.opentelemetry.io/collector/internal/configunmarshaler" + "go.opentelemetry.io/collector/service/internal/configunmarshaler" ) // LoadConfig loads a config.Config from file, and does NOT validate the configuration. @@ -28,7 +28,7 @@ func LoadConfig(fileName string, factories component.Factories) (*config.Config, if err != nil { return nil, err } - return configunmarshaler.NewDefault().Unmarshal(cfgMap, factories) + return configunmarshaler.New().Unmarshal(cfgMap, factories) } // LoadConfigAndValidate loads a config from the file, and validates the configuration. diff --git a/service/settings.go b/service/settings.go index a634d648908..9b70ac53c2e 100644 --- a/service/settings.go +++ b/service/settings.go @@ -15,7 +15,6 @@ package service // import "go.opentelemetry.io/collector/service" import ( - "go.opentelemetry.io/contrib/zpages" "go.uber.org/zap" "go.opentelemetry.io/collector/component" @@ -36,9 +35,6 @@ type svcSettings struct { // Telemetry represents the service configured telemetry for all the components. Telemetry component.TelemetrySettings - // ZPagesSpanProcessor represents the SpanProcessor for tracez page. - ZPagesSpanProcessor *zpages.SpanProcessor - // AsyncErrorChannel is the channel that is used to report fatal errors. AsyncErrorChannel chan error } diff --git a/service/zpages.go b/service/zpages.go index a0164fa4b73..8b315b442fc 100644 --- a/service/zpages.go +++ b/service/zpages.go @@ -19,8 +19,6 @@ import ( "path" "sort" - otelzpages "go.opentelemetry.io/contrib/zpages" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/internal/version" "go.opentelemetry.io/collector/service/featuregate" @@ -28,7 +26,6 @@ import ( ) const ( - tracezPath = "tracez" servicezPath = "servicez" pipelinezPath = "pipelinez" extensionzPath = "extensionz" @@ -41,7 +38,6 @@ const ( ) func (host *serviceHost) RegisterZPages(mux *http.ServeMux, pathPrefix string) { - mux.Handle(path.Join(pathPrefix, tracezPath), otelzpages.NewTracezHandler(host.zPagesSpanProcessor)) mux.HandleFunc(path.Join(pathPrefix, servicezPath), host.handleServicezRequest) mux.HandleFunc(path.Join(pathPrefix, pipelinezPath), host.handlePipelinezRequest) mux.HandleFunc(path.Join(pathPrefix, featurezPath), handleFeaturezRequest) diff --git a/versions.yaml b/versions.yaml index 0ad42428d9d..1470965a4bf 100644 --- a/versions.yaml +++ b/versions.yaml @@ -13,13 +13,14 @@ # limitations under the License. module-sets: - collector-base: - version: v0.50.0 + collector-core: + version: v0.51.0 modules: - go.opentelemetry.io/collector - go.opentelemetry.io/collector/cmd/builder - go.opentelemetry.io/collector/semconv - go.opentelemetry.io/collector/pdata + excluded-modules: - go.opentelemetry.io/collector/cmd/otelcorecol - go.opentelemetry.io/collector/internal/tools