From 7638bb298172330241375ed5dc3c50637caa645f Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Fri, 9 Aug 2024 08:12:05 -0700 Subject: [PATCH 1/5] [mdatagen] export ScopeName in internal/metadata package (#10845) This can be used by components that need to set their scope name manually. Will save component owners from having to store a variable, which may diverge from the scope name used by the component for emitting its own telemetry. There are about a dozen components in contrib that could use this today. Alternatively, I could just update the scope name strings in the components manually. --------- Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- .../codeboten_mdatagen-expose-scope-name.yaml | 25 +++++++++++++++++++ .../internal/metadata/generated_telemetry.go | 6 +++-- cmd/mdatagen/main_test.go | 12 ++++++--- cmd/mdatagen/templates/telemetry.go.tmpl | 6 +++-- .../internal/metadata/generated_telemetry.go | 6 +++-- .../internal/metadata/generated_telemetry.go | 6 +++-- .../internal/metadata/generated_telemetry.go | 6 +++-- .../internal/metadata/generated_telemetry.go | 6 +++-- .../internal/metadata/generated_telemetry.go | 6 +++-- .../internal/metadata/generated_telemetry.go | 6 +++-- 10 files changed, 65 insertions(+), 20 deletions(-) create mode 100644 .chloggen/codeboten_mdatagen-expose-scope-name.yaml diff --git a/.chloggen/codeboten_mdatagen-expose-scope-name.yaml b/.chloggen/codeboten_mdatagen-expose-scope-name.yaml new file mode 100644 index 00000000000..f4796bc589a --- /dev/null +++ b/.chloggen/codeboten_mdatagen-expose-scope-name.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: mdatagen + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: export ScopeName in internal/metadata package + +# One or more tracking issues or pull requests related to the change +issues: [10845] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: This can be used by components that need to set their scope name manually. Will save component owners from having to store a variable, which may diverge from the scope name used by the component for emitting its own telemetry. + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go index 0626d810b93..8ae0086c0a9 100644 --- a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go +++ b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go @@ -14,12 +14,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "go.opentelemetry.io/collector/internal/receiver/samplereceiver" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("go.opentelemetry.io/collector/internal/receiver/samplereceiver") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/internal/receiver/samplereceiver") + return settings.TracerProvider.Tracer(ScopeName) } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/cmd/mdatagen/main_test.go b/cmd/mdatagen/main_test.go index 7136b9b8f80..d0df9f483d8 100644 --- a/cmd/mdatagen/main_test.go +++ b/cmd/mdatagen/main_test.go @@ -546,12 +546,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("") + return settings.TracerProvider.Tracer(ScopeName) } `, }, @@ -580,12 +582,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("") + return settings.TracerProvider.Tracer(ScopeName) } `, }, diff --git a/cmd/mdatagen/templates/telemetry.go.tmpl b/cmd/mdatagen/templates/telemetry.go.tmpl index 7610f04a55f..1b9f604bd24 100644 --- a/cmd/mdatagen/templates/telemetry.go.tmpl +++ b/cmd/mdatagen/templates/telemetry.go.tmpl @@ -16,12 +16,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "{{ .ScopeName }}" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("{{ .ScopeName }}") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("{{ .ScopeName }}") + return settings.TracerProvider.Tracer(ScopeName) } {{- if .Telemetry.Metrics }} diff --git a/exporter/exporterhelper/internal/metadata/generated_telemetry.go b/exporter/exporterhelper/internal/metadata/generated_telemetry.go index d0b27bf441b..f52d0d1082b 100644 --- a/exporter/exporterhelper/internal/metadata/generated_telemetry.go +++ b/exporter/exporterhelper/internal/metadata/generated_telemetry.go @@ -14,12 +14,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "go.opentelemetry.io/collector/exporter/exporterhelper" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("go.opentelemetry.io/collector/exporter/exporterhelper") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/exporter/exporterhelper") + return settings.TracerProvider.Tracer(ScopeName) } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/processor/batchprocessor/internal/metadata/generated_telemetry.go b/processor/batchprocessor/internal/metadata/generated_telemetry.go index 554da0686db..9b64048ac68 100644 --- a/processor/batchprocessor/internal/metadata/generated_telemetry.go +++ b/processor/batchprocessor/internal/metadata/generated_telemetry.go @@ -14,12 +14,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "go.opentelemetry.io/collector/processor/batchprocessor" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("go.opentelemetry.io/collector/processor/batchprocessor") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/processor/batchprocessor") + return settings.TracerProvider.Tracer(ScopeName) } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/processor/processorhelper/internal/metadata/generated_telemetry.go b/processor/processorhelper/internal/metadata/generated_telemetry.go index 6c145bb65cd..a103da30750 100644 --- a/processor/processorhelper/internal/metadata/generated_telemetry.go +++ b/processor/processorhelper/internal/metadata/generated_telemetry.go @@ -13,12 +13,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "go.opentelemetry.io/collector/processor/processorhelper" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("go.opentelemetry.io/collector/processor/processorhelper") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/processor/processorhelper") + return settings.TracerProvider.Tracer(ScopeName) } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/receiver/receiverhelper/internal/metadata/generated_telemetry.go b/receiver/receiverhelper/internal/metadata/generated_telemetry.go index 8e0b5a8455a..88ea56e46f7 100644 --- a/receiver/receiverhelper/internal/metadata/generated_telemetry.go +++ b/receiver/receiverhelper/internal/metadata/generated_telemetry.go @@ -13,12 +13,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "go.opentelemetry.io/collector/receiver/receiverhelper" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("go.opentelemetry.io/collector/receiver/receiverhelper") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/receiver/receiverhelper") + return settings.TracerProvider.Tracer(ScopeName) } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/receiver/scraperhelper/internal/metadata/generated_telemetry.go b/receiver/scraperhelper/internal/metadata/generated_telemetry.go index 98cf15f4123..42e96d62d1b 100644 --- a/receiver/scraperhelper/internal/metadata/generated_telemetry.go +++ b/receiver/scraperhelper/internal/metadata/generated_telemetry.go @@ -13,12 +13,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "go.opentelemetry.io/collector/receiver/scraperhelper" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("go.opentelemetry.io/collector/receiver/scraperhelper") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/receiver/scraperhelper") + return settings.TracerProvider.Tracer(ScopeName) } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/service/internal/metadata/generated_telemetry.go b/service/internal/metadata/generated_telemetry.go index edefccd1a54..6a159adb818 100644 --- a/service/internal/metadata/generated_telemetry.go +++ b/service/internal/metadata/generated_telemetry.go @@ -14,12 +14,14 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) +const ScopeName = "go.opentelemetry.io/collector/service" + func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter("go.opentelemetry.io/collector/service") + return settings.MeterProvider.Meter(ScopeName) } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/service") + return settings.TracerProvider.Tracer(ScopeName) } // TelemetryBuilder provides an interface for components to report telemetry From 8abfa023a549c2c3894bb39f1db37a530542c716 Mon Sep 17 00:00:00 2001 From: "John L. Peterson (Jack)" Date: Fri, 9 Aug 2024 13:16:09 -0400 Subject: [PATCH 2/5] Migrate ocb binary release to opentelemetry-collector-releases (#10710) After discussion with the collector SIG call this week, July 31st, I have made small tweaks to the artifact release that will not require an "extra step" of pushing tags. If these changes are accepted, the distributions will be released under tag "vX.XXX.X" and the ocb binaries will be released under "cmd/builder/vX.XXX.X" but both under this repo, opentelemetry-collector-releases. The workflow `builder-release.yaml` in releases repo will push the additional tags necessary for the builder release. Refactoring the release process as mentioned in past issues/PRs. ocb binary is currently released in a separate release tag under this repository, which makes it harder to find and inconsistent with the rest of the binaries and images releasing in the opentelemetry-collector-releases repository. Releasing the ocb binaries in opentelemetry-collector-releases makes this process more standardized and also opens the opportunity to release more tools alongside ocb binary down the road, like corresponding docker images (as discussed in #5712). #### Link to tracking issue Fixes #10662 Mentioned in [releases issue # 295](https://github.com/open-telemetry/opentelemetry-collector-releases/issues/295) [Corresponding PR in opentelemetry-collector-releases](https://github.com/open-telemetry/opentelemetry-collector-releases/pull/608) #### Testing Sample binary release in [forked jackgopack4/opentelemetry-collector-releases repo](https://github.com/jackgopack4/opentelemetry-collector-releases/releases/tag/cmd%2Fbuilder%2Fv0.106.1) #### Documentation Updated corresponding documentation to reflect new release process --------- Co-authored-by: Pablo Baeyens --- .chloggen/ocb-migration.yaml | 25 ++++++++++++ .github/workflows/check-goreleaser.yaml | 32 --------------- ...r-release.yaml => sourcecode-release.yaml} | 17 +------- cmd/builder/.goreleaser.yml | 39 ------------------- docs/release.md | 11 +++--- 5 files changed, 32 insertions(+), 92 deletions(-) create mode 100644 .chloggen/ocb-migration.yaml delete mode 100644 .github/workflows/check-goreleaser.yaml rename .github/workflows/{builder-release.yaml => sourcecode-release.yaml} (72%) delete mode 100644 cmd/builder/.goreleaser.yml diff --git a/.chloggen/ocb-migration.yaml b/.chloggen/ocb-migration.yaml new file mode 100644 index 00000000000..a5b05552105 --- /dev/null +++ b/.chloggen/ocb-migration.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: ocb + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: migrate build and release of ocb binaries to opentelemetry-collector-releases repository + +# One or more tracking issues or pull requests related to the change +issues: [10710] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: ocb binaries will now be released under open-telemetry/opentelemetry-collector-releases tagged as "cmd/builder/vX.XXX.X" + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/.github/workflows/check-goreleaser.yaml b/.github/workflows/check-goreleaser.yaml deleted file mode 100644 index 875b4b17f7c..00000000000 --- a/.github/workflows/check-goreleaser.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Check GoReleaser Config -on: - push: - branches: [main] - tags: - - "v[0-9]+.[0-9]+.[0-9]+*" - pull_request: - -permissions: - contents: read - -jobs: - check: - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version: ~1.21.5 - - name: Check GoReleaser - uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 - with: - distribution: goreleaser-pro - version: latest - args: check --verbose cmd/builder/.goreleaser.yml - env: - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/builder-release.yaml b/.github/workflows/sourcecode-release.yaml similarity index 72% rename from .github/workflows/builder-release.yaml rename to .github/workflows/sourcecode-release.yaml index b6ae4795adb..7e767539fc9 100644 --- a/.github/workflows/builder-release.yaml +++ b/.github/workflows/sourcecode-release.yaml @@ -1,9 +1,9 @@ -name: Builder - Release +name: Source Code - Release on: push: tags: - - 'v*' + - "v*" jobs: goreleaser: @@ -13,19 +13,6 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 0 - - name: Setup Go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version: ~1.21.5 - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 - with: - distribution: goreleaser-pro - version: latest - args: release --clean -f cmd/builder/.goreleaser.yml - env: - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create Github Release run: | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -n "### Images and binaries here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/${{ github.ref_name }}" diff --git a/cmd/builder/.goreleaser.yml b/cmd/builder/.goreleaser.yml deleted file mode 100644 index a964ac6c6ee..00000000000 --- a/cmd/builder/.goreleaser.yml +++ /dev/null @@ -1,39 +0,0 @@ -before: - hooks: - - go mod download -monorepo: - tag_prefix: cmd/builder/ - dir: cmd/builder -builds: - - flags: - - -trimpath - ldflags: - - -s -w -X go.opentelemetry.io/collector/cmd/builder/internal.version={{.Version}} -X go.opentelemetry.io/collector/cmd/builder/internal.date={{.Date}} - env: - - CGO_ENABLED=0 - goos: - - linux - - windows - - darwin - goarch: - - amd64 - - arm64 - - ppc64le - ignore: - - goos: windows - goarch: arm64 - binary: ocb -release: - github: - owner: open-telemetry - name: opentelemetry-collector - header: | - ### Images and binaries here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/{{ .Tag }} -archives: - - format: binary -checksum: - name_template: "checksums.txt" -snapshot: - name_template: "{{ .Tag }}-next" -changelog: - disable: true diff --git a/docs/release.md b/docs/release.md index 38dad9e75cb..9057f06d1c1 100644 --- a/docs/release.md +++ b/docs/release.md @@ -46,9 +46,7 @@ It is possible that a core approver isn't a contrib approver. In that case, the If you set your remote using `https` you need to include `REMOTE=https://github.com/open-telemetry/opentelemetry-collector.git` in each command. Wait for the new tag build to pass successfully. -6. The release script for the collector builder should create a new GitHub release for the builder. This is a separate release from the core, but we might join them in the future if it makes sense. - -7. A new `v0.85.0` release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md and CHANGELOG-API.md as the release's description. +6. A new `v0.85.0` source code release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md and CHANGELOG-API.md as the release's description. ## Releasing opentelemetry-collector-contrib @@ -74,10 +72,9 @@ It is possible that a core approver isn't a contrib approver. In that case, the 5. A new `v0.85.0` release should be automatically created on Github by now. Edit it and use the contents from the CHANGELOG.md as the release's description. ## Producing the artifacts - The last step of the release process creates artifacts for the new version of the collector and publishes images to Dockerhub. The steps in this portion of the release are done in the [opentelemetry-collector-releases](https://github.com/open-telemetry/opentelemetry-collector-releases) repo. -1. Update the `./distribution/**/manifest.yaml` files to include the new release version. +1. Update the `./distributions/**/manifest.yaml` files to include the new release version. 2. Update the builder version in `OTELCOL_BUILDER_VERSION` to the new release in the `Makefile`. While this might not be strictly necessary for every release, this is a good practice. @@ -86,12 +83,14 @@ The last step of the release process creates artifacts for the new version of th 4. Check out the commit created by merging the PR and tag with the new release version by running the `make push-tags TAG=v0.85.0` command. If you set your remote using `https` you need to include `REMOTE=https://github.com/open-telemetry/opentelemetry-collector-releases.git` in each command. Wait for the new tag build to pass successfully. -5. Ensure the "Release Core", "Release Contrib" and "Release k8s" actions pass, this will +5. Ensure the "Release Core", "Release Contrib", "Release k8s", and "Builder - Release" actions pass, this will 1. push new container images to `https://hub.docker.com/repository/docker/otel/opentelemetry-collector`, `https://hub.docker.com/repository/docker/otel/opentelemetry-collector-contrib` and `https://hub.docker.com/repository/docker/otel/opentelemetry-collector-k8s` 2. create a Github release for the tag and push all the build artifacts to the Github release. See [example](https://github.com/open-telemetry/opentelemetry-collector-releases/actions/workflows/release-core.yaml). + 3. build and release ocb binaries under a separate tagged Github release, e.g. `cmd/builder/v0.85.0` + ## Troubleshooting 1. `unknown revision internal/coreinternal/v0.85.0` -- This is typically an indication that there's a dependency on a new module. You can fix it by adding a new `replaces` entry to the `go.mod` for the affected module. From 4889aef53c89541efeba7290c3cec6462f3e3c1e Mon Sep 17 00:00:00 2001 From: Moritz Wiesinger Date: Fri, 9 Aug 2024 20:56:06 +0200 Subject: [PATCH 3/5] [chore] improve release version validations (#10826) #### Description This PR improves the version validation during the release preparation workflow. #### Link to tracking issue Fixes #10735 --------- Signed-off-by: Moritz Wiesinger --- .github/workflows/prepare-release.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 5074ed2acfe..cf0fd7621d3 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -25,6 +25,7 @@ jobs: steps: - name: Validate version format + shell: bash run: | validate_beta_version() { local regex_pattern_beta='^[0-9]+\.[0-9]+\.[0-9]+$' @@ -42,13 +43,20 @@ jobs: fi } - validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta" + if [[ ! -z "${{ inputs.candidate-beta }}" ]]; then + validate_beta_version "${{ inputs.candidate-beta }}" "candidate-beta" + fi validate_beta_version "${{ inputs.current-beta }}" "current-beta" + if [[ ! -z "${{ inputs.candidate-stable }}" ]]; then validate_stable_version "${{ inputs.candidate-stable }}" "candidate-stable" fi validate_stable_version "${{ inputs.current-stable }}" "current-stable" - shell: bash + + if [[ -z "${{ inputs.candidate-beta }}" && -z "${{ inputs.candidate-stable }}" ]]; then + echo "Candidate version is not set for beta or stable. Please set a version to proceed." + exit 1 + fi # Releasing opentelemetry-collector prepare-release: From 053d370605073cee8da805a1f0a2de6b35bb8494 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 9 Aug 2024 11:59:11 -0700 Subject: [PATCH 4/5] [mdatagen] expose host in generated test code by mdatagen (#10765) #### Description Expose a setting on tests::host to set up your own host initialization code Some receivers require a host that has additional capabilities such as exposing exporters. For those, we can expose a setting that allows them to place a different host in the generated code. --- .chloggen/expose_host_tests.yaml | 27 +++++++++++++++++++ cmd/mdatagen/loader.go | 5 ++-- cmd/mdatagen/loader_test.go | 2 ++ cmd/mdatagen/templates/component_test.go.tmpl | 12 ++++----- 4 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 .chloggen/expose_host_tests.yaml diff --git a/.chloggen/expose_host_tests.yaml b/.chloggen/expose_host_tests.yaml new file mode 100644 index 00000000000..61921a909d1 --- /dev/null +++ b/.chloggen/expose_host_tests.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: mdatagen + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Expose a setting on tests::host to set up your own host initialization code + +# One or more tracking issues or pull requests related to the change +issues: [10765] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + Some receivers require a host that has additional capabilities such as exposing exporters. + For those, we can expose a setting that allows them to place a different host in the generated code. + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/cmd/mdatagen/loader.go b/cmd/mdatagen/loader.go index 70a316981c7..ac216d9e681 100644 --- a/cmd/mdatagen/loader.go +++ b/cmd/mdatagen/loader.go @@ -229,6 +229,7 @@ type tests struct { SkipShutdown bool `mapstructure:"skip_shutdown"` GoLeak goLeak `mapstructure:"goleak"` ExpectConsumerError bool `mapstructure:"expect_consumer_error"` + Host string `mapstructure:"host"` } type telemetry struct { @@ -257,7 +258,7 @@ type metadata struct { ScopeName string `mapstructure:"scope_name"` // ShortFolderName is the shortened folder name of the component, removing class if present ShortFolderName string `mapstructure:"-"` - + // Tests is the set of tests generated with the component Tests tests `mapstructure:"tests"` } @@ -285,7 +286,7 @@ func loadMetadata(filePath string) (metadata, error) { return metadata{}, err } - md := metadata{ShortFolderName: shortFolderName(filePath)} + md := metadata{ShortFolderName: shortFolderName(filePath), Tests: tests{Host: "componenttest.NewNopHost()"}} if err = conf.Unmarshal(&md); err != nil { return md, err } diff --git a/cmd/mdatagen/loader_test.go b/cmd/mdatagen/loader_test.go index 63d7277e2ea..5da03588a31 100644 --- a/cmd/mdatagen/loader_test.go +++ b/cmd/mdatagen/loader_test.go @@ -280,6 +280,7 @@ func TestLoadMetadata(t *testing.T) { }, ScopeName: "go.opentelemetry.io/collector/internal/receiver/samplereceiver", ShortFolderName: "sample", + Tests: tests{Host: "componenttest.NewNopHost()"}, }, }, { @@ -289,6 +290,7 @@ func TestLoadMetadata(t *testing.T) { Parent: "parentComponent", ScopeName: "go.opentelemetry.io/collector/cmd/mdatagen", ShortFolderName: "testdata", + Tests: tests{Host: "componenttest.NewNopHost()"}, }, }, { diff --git a/cmd/mdatagen/templates/component_test.go.tmpl b/cmd/mdatagen/templates/component_test.go.tmpl index bfc70c2b751..c2d052bf602 100644 --- a/cmd/mdatagen/templates/component_test.go.tmpl +++ b/cmd/mdatagen/templates/component_test.go.tmpl @@ -118,7 +118,7 @@ func TestComponentLifecycle(t *testing.T) { t.Run(test.name + "-lifecycle", func(t *testing.T) { c, err := test.createFn(context.Background(), exportertest.NewNopSettings(), cfg) require.NoError(t, err) - host := componenttest.NewNopHost() + host := {{ .Tests.Host }} err = c.Start(context.Background(), host) require.NoError(t, err) require.NotPanics(t, func() { @@ -215,7 +215,7 @@ func TestComponentLifecycle(t *testing.T) { t.Run(test.name + "-lifecycle", func(t *testing.T) { c, err := test.createFn(context.Background(), processortest.NewNopSettings(), cfg) require.NoError(t, err) - host := componenttest.NewNopHost() + host := {{ .Tests.Host }} err = c.Start(context.Background(), host) require.NoError(t, err) require.NotPanics(t, func() { @@ -310,7 +310,7 @@ func TestComponentLifecycle(t *testing.T) { t.Run(test.name + "-lifecycle", func(t *testing.T) { firstRcvr, err := test.createFn(context.Background(), receivertest.NewNopSettings(), cfg) require.NoError(t, err) - host := componenttest.NewNopHost() + host := {{ .Tests.Host }} require.NoError(t, err) require.NoError(t, firstRcvr.Start(context.Background(), host)) require.NoError(t, firstRcvr.Shutdown(context.Background())) @@ -348,12 +348,12 @@ func TestComponentLifecycle(t *testing.T) { t.Run("lifecycle", func(t *testing.T) { firstExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) - require.NoError(t, firstExt.Start(context.Background(), componenttest.NewNopHost())) + require.NoError(t, firstExt.Start(context.Background(), {{ .Tests.Host }})) require.NoError(t, firstExt.Shutdown(context.Background())) secondExt, err := factory.CreateExtension(context.Background(), extensiontest.NewNopSettings(), cfg) require.NoError(t, err) - require.NoError(t, secondExt.Start(context.Background(), componenttest.NewNopHost())) + require.NoError(t, secondExt.Start(context.Background(), {{ .Tests.Host }})) require.NoError(t, secondExt.Shutdown(context.Background())) }) {{- end }} @@ -472,7 +472,7 @@ func TestComponentLifecycle(t *testing.T) { t.Run(test.name + "-lifecycle", func(t *testing.T) { firstConnector, err := test.createFn(context.Background(), connectortest.NewNopSettings(), cfg) require.NoError(t, err) - host := componenttest.NewNopHost() + host := {{ .Tests.Host }} require.NoError(t, err) require.NoError(t, firstConnector.Start(context.Background(), host)) require.NoError(t, firstConnector.Shutdown(context.Background())) From ef07ea073562c4eb4d63a9032e84a802d8424fe2 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Fri, 9 Aug 2024 12:10:11 -0700 Subject: [PATCH 5/5] [mdatagen] move ScopeName to generated_status (#10848) This will make it available to most components, as the generated_telemetry is only generated for components that have internal telemetry configured. Arguably the scope name should be moved to its own file, but i'd rather not add yet another file if possible. Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_telemetry.go | 6 ++---- cmd/mdatagen/main_test.go | 18 ++++++++---------- cmd/mdatagen/templates/status.go.tmpl | 3 ++- cmd/mdatagen/templates/telemetry.go.tmpl | 6 ++---- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_telemetry.go | 6 ++---- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_telemetry.go | 6 ++---- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_telemetry.go | 6 ++---- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_status.go | 3 ++- .../internal/metadata/generated_telemetry.go | 6 ++---- .../internal/metadata/generated_telemetry.go | 6 ++---- .../internal/metadata/generated_telemetry.go | 6 ++---- 24 files changed, 54 insertions(+), 57 deletions(-) diff --git a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_status.go b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_status.go index e3e8df2ad14..7f86f1d8fc1 100644 --- a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_status.go +++ b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("sample") + Type = component.MustNewType("sample") + ScopeName = "go.opentelemetry.io/collector/internal/receiver/samplereceiver" ) const ( diff --git a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go index 8ae0086c0a9..0626d810b93 100644 --- a/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go +++ b/cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_telemetry.go @@ -14,14 +14,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "go.opentelemetry.io/collector/internal/receiver/samplereceiver" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("go.opentelemetry.io/collector/internal/receiver/samplereceiver") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/internal/receiver/samplereceiver") } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/cmd/mdatagen/main_test.go b/cmd/mdatagen/main_test.go index d0df9f483d8..62c2159fe63 100644 --- a/cmd/mdatagen/main_test.go +++ b/cmd/mdatagen/main_test.go @@ -462,7 +462,8 @@ import ( ) var ( - Type = component.MustNewType("foo") + Type = component.MustNewType("foo") + ScopeName = "" ) const ( @@ -491,7 +492,8 @@ import ( ) var ( - Type = component.MustNewType("foo") + Type = component.MustNewType("foo") + ScopeName = "" ) const ( @@ -546,14 +548,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("") } `, }, @@ -582,14 +582,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("") } `, }, diff --git a/cmd/mdatagen/templates/status.go.tmpl b/cmd/mdatagen/templates/status.go.tmpl index b90047f7dd0..789605ee01f 100644 --- a/cmd/mdatagen/templates/status.go.tmpl +++ b/cmd/mdatagen/templates/status.go.tmpl @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("{{ .Type }}") + Type = component.MustNewType("{{ .Type }}") + ScopeName = "{{ .ScopeName }}" ) const ( diff --git a/cmd/mdatagen/templates/telemetry.go.tmpl b/cmd/mdatagen/templates/telemetry.go.tmpl index 1b9f604bd24..7610f04a55f 100644 --- a/cmd/mdatagen/templates/telemetry.go.tmpl +++ b/cmd/mdatagen/templates/telemetry.go.tmpl @@ -16,14 +16,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "{{ .ScopeName }}" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("{{ .ScopeName }}") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("{{ .ScopeName }}") } {{- if .Telemetry.Metrics }} diff --git a/connector/forwardconnector/internal/metadata/generated_status.go b/connector/forwardconnector/internal/metadata/generated_status.go index 25007e42e02..87699068c03 100644 --- a/connector/forwardconnector/internal/metadata/generated_status.go +++ b/connector/forwardconnector/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("forward") + Type = component.MustNewType("forward") + ScopeName = "go.opentelemetry.io/collector/connector/forwardconnector" ) const ( diff --git a/exporter/debugexporter/internal/metadata/generated_status.go b/exporter/debugexporter/internal/metadata/generated_status.go index 608b23c1536..b4588f75200 100644 --- a/exporter/debugexporter/internal/metadata/generated_status.go +++ b/exporter/debugexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("debug") + Type = component.MustNewType("debug") + ScopeName = "go.opentelemetry.io/collector/exporter/debugexporter" ) const ( diff --git a/exporter/exporterhelper/internal/metadata/generated_telemetry.go b/exporter/exporterhelper/internal/metadata/generated_telemetry.go index f52d0d1082b..d0b27bf441b 100644 --- a/exporter/exporterhelper/internal/metadata/generated_telemetry.go +++ b/exporter/exporterhelper/internal/metadata/generated_telemetry.go @@ -14,14 +14,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "go.opentelemetry.io/collector/exporter/exporterhelper" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("go.opentelemetry.io/collector/exporter/exporterhelper") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/exporter/exporterhelper") } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/exporter/loggingexporter/internal/metadata/generated_status.go b/exporter/loggingexporter/internal/metadata/generated_status.go index ce3f313e8e0..7c415b23aae 100644 --- a/exporter/loggingexporter/internal/metadata/generated_status.go +++ b/exporter/loggingexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("logging") + Type = component.MustNewType("logging") + ScopeName = "go.opentelemetry.io/collector/exporter/loggingexporter" ) const ( diff --git a/exporter/nopexporter/internal/metadata/generated_status.go b/exporter/nopexporter/internal/metadata/generated_status.go index 1901cab9ee6..d7336115c61 100644 --- a/exporter/nopexporter/internal/metadata/generated_status.go +++ b/exporter/nopexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("nop") + Type = component.MustNewType("nop") + ScopeName = "go.opentelemetry.io/collector/exporter/nopexporter" ) const ( diff --git a/exporter/otlpexporter/internal/metadata/generated_status.go b/exporter/otlpexporter/internal/metadata/generated_status.go index c9cff844fa2..6003002a1a3 100644 --- a/exporter/otlpexporter/internal/metadata/generated_status.go +++ b/exporter/otlpexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("otlp") + Type = component.MustNewType("otlp") + ScopeName = "go.opentelemetry.io/collector/exporter/otlpexporter" ) const ( diff --git a/exporter/otlphttpexporter/internal/metadata/generated_status.go b/exporter/otlphttpexporter/internal/metadata/generated_status.go index 8af2905a456..c38e6de2550 100644 --- a/exporter/otlphttpexporter/internal/metadata/generated_status.go +++ b/exporter/otlphttpexporter/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("otlphttp") + Type = component.MustNewType("otlphttp") + ScopeName = "go.opentelemetry.io/collector/exporter/otlphttpexporter" ) const ( diff --git a/extension/ballastextension/internal/metadata/generated_status.go b/extension/ballastextension/internal/metadata/generated_status.go index 54e3d38805d..2acd5fd7570 100644 --- a/extension/ballastextension/internal/metadata/generated_status.go +++ b/extension/ballastextension/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("memory_ballast") + Type = component.MustNewType("memory_ballast") + ScopeName = "go.opentelemetry.io/collector/extension/ballastextension" ) const ( diff --git a/extension/memorylimiterextension/internal/metadata/generated_status.go b/extension/memorylimiterextension/internal/metadata/generated_status.go index 21472c5d5aa..d8e99a2bebc 100644 --- a/extension/memorylimiterextension/internal/metadata/generated_status.go +++ b/extension/memorylimiterextension/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("memory_limiter") + Type = component.MustNewType("memory_limiter") + ScopeName = "go.opentelemetry.io/collector/extension/memorylimiterextension" ) const ( diff --git a/extension/zpagesextension/internal/metadata/generated_status.go b/extension/zpagesextension/internal/metadata/generated_status.go index ee7c714b77a..cff3d7b0b2c 100644 --- a/extension/zpagesextension/internal/metadata/generated_status.go +++ b/extension/zpagesextension/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("zpages") + Type = component.MustNewType("zpages") + ScopeName = "go.opentelemetry.io/collector/extension/zpagesextension" ) const ( diff --git a/processor/batchprocessor/internal/metadata/generated_status.go b/processor/batchprocessor/internal/metadata/generated_status.go index c77d7c0a539..8f1fa8cfe60 100644 --- a/processor/batchprocessor/internal/metadata/generated_status.go +++ b/processor/batchprocessor/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("batch") + Type = component.MustNewType("batch") + ScopeName = "go.opentelemetry.io/collector/processor/batchprocessor" ) const ( diff --git a/processor/batchprocessor/internal/metadata/generated_telemetry.go b/processor/batchprocessor/internal/metadata/generated_telemetry.go index 9b64048ac68..554da0686db 100644 --- a/processor/batchprocessor/internal/metadata/generated_telemetry.go +++ b/processor/batchprocessor/internal/metadata/generated_telemetry.go @@ -14,14 +14,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "go.opentelemetry.io/collector/processor/batchprocessor" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("go.opentelemetry.io/collector/processor/batchprocessor") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/processor/batchprocessor") } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/processor/memorylimiterprocessor/internal/metadata/generated_status.go b/processor/memorylimiterprocessor/internal/metadata/generated_status.go index bd77272f645..0e841608278 100644 --- a/processor/memorylimiterprocessor/internal/metadata/generated_status.go +++ b/processor/memorylimiterprocessor/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("memory_limiter") + Type = component.MustNewType("memory_limiter") + ScopeName = "go.opentelemetry.io/collector/processor/memorylimiterprocessor" ) const ( diff --git a/processor/processorhelper/internal/metadata/generated_telemetry.go b/processor/processorhelper/internal/metadata/generated_telemetry.go index a103da30750..6c145bb65cd 100644 --- a/processor/processorhelper/internal/metadata/generated_telemetry.go +++ b/processor/processorhelper/internal/metadata/generated_telemetry.go @@ -13,14 +13,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "go.opentelemetry.io/collector/processor/processorhelper" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("go.opentelemetry.io/collector/processor/processorhelper") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/processor/processorhelper") } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/receiver/nopreceiver/internal/metadata/generated_status.go b/receiver/nopreceiver/internal/metadata/generated_status.go index 1901cab9ee6..a8716db919c 100644 --- a/receiver/nopreceiver/internal/metadata/generated_status.go +++ b/receiver/nopreceiver/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("nop") + Type = component.MustNewType("nop") + ScopeName = "go.opentelemetry.io/collector/receiver/nopreceiver" ) const ( diff --git a/receiver/otlpreceiver/internal/metadata/generated_status.go b/receiver/otlpreceiver/internal/metadata/generated_status.go index c9cff844fa2..02715c16850 100644 --- a/receiver/otlpreceiver/internal/metadata/generated_status.go +++ b/receiver/otlpreceiver/internal/metadata/generated_status.go @@ -7,7 +7,8 @@ import ( ) var ( - Type = component.MustNewType("otlp") + Type = component.MustNewType("otlp") + ScopeName = "go.opentelemetry.io/collector/receiver/otlpreceiver" ) const ( diff --git a/receiver/receiverhelper/internal/metadata/generated_telemetry.go b/receiver/receiverhelper/internal/metadata/generated_telemetry.go index 88ea56e46f7..8e0b5a8455a 100644 --- a/receiver/receiverhelper/internal/metadata/generated_telemetry.go +++ b/receiver/receiverhelper/internal/metadata/generated_telemetry.go @@ -13,14 +13,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "go.opentelemetry.io/collector/receiver/receiverhelper" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("go.opentelemetry.io/collector/receiver/receiverhelper") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/receiver/receiverhelper") } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/receiver/scraperhelper/internal/metadata/generated_telemetry.go b/receiver/scraperhelper/internal/metadata/generated_telemetry.go index 42e96d62d1b..98cf15f4123 100644 --- a/receiver/scraperhelper/internal/metadata/generated_telemetry.go +++ b/receiver/scraperhelper/internal/metadata/generated_telemetry.go @@ -13,14 +13,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "go.opentelemetry.io/collector/receiver/scraperhelper" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("go.opentelemetry.io/collector/receiver/scraperhelper") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/receiver/scraperhelper") } // TelemetryBuilder provides an interface for components to report telemetry diff --git a/service/internal/metadata/generated_telemetry.go b/service/internal/metadata/generated_telemetry.go index 6a159adb818..edefccd1a54 100644 --- a/service/internal/metadata/generated_telemetry.go +++ b/service/internal/metadata/generated_telemetry.go @@ -14,14 +14,12 @@ import ( "go.opentelemetry.io/collector/config/configtelemetry" ) -const ScopeName = "go.opentelemetry.io/collector/service" - func Meter(settings component.TelemetrySettings) metric.Meter { - return settings.MeterProvider.Meter(ScopeName) + return settings.MeterProvider.Meter("go.opentelemetry.io/collector/service") } func Tracer(settings component.TelemetrySettings) trace.Tracer { - return settings.TracerProvider.Tracer(ScopeName) + return settings.TracerProvider.Tracer("go.opentelemetry.io/collector/service") } // TelemetryBuilder provides an interface for components to report telemetry