Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

v0.111.0 broke: "service/telemetry/internal/otelinit/config.go" #11478

Closed
mjnowen opened this issue Oct 17, 2024 · 6 comments
Closed

v0.111.0 broke: "service/telemetry/internal/otelinit/config.go" #11478

mjnowen opened this issue Oct 17, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@mjnowen
Copy link

mjnowen commented Oct 17, 2024

Describe the bug
re: go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go

As a result of this PR: #11205

Tagging @bogdandrutu for awareness^

go build/test fails with multiple undefined/undeclared-imported-name.

# go.opentelemetry.io/collector/service/telemetry/internal/otelinit
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go:170:39: undefined: config.MetricExporter
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go:177:64: undefined: config.MetricExporter
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go:219:9: invalid argument: otlpConfig.Endpoint (variable of type *string) for built-in len
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go:220:51: cannot use otlpConfig.Endpoint (variable of type *string) as string value in argument to normalizeEndpoint
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go:244:50: cannot use otlpConfig.Headers (variable of type []config.NameStringValuePair) as map[string]string value in argument to otlpmetricgrpc.WithHeaders
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go:265:9: invalid argument: otlpConfig.Endpoint (variable of type *string) for built-in len
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go:266:51: cannot use otlpConfig.Endpoint (variable of type *string) as string value in argument to normalizeEndpoint
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.111.0/telemetry/internal/otelinit/config.go:293:50: cannot use otlpConfig.Headers (variable of type []config.NameStringValuePair) as map[string]string value in argument to otlpmetrichttp.WithHeaders

Steps to reproduce
Upgrade OTEL go project from v0.110.0 -> v0.111.0, go project now fails to test/build with above errors.

What did you expect to see?
Successful go test/build without regression

What did you see instead?
See above error messages

What version did you use?
v0.111.0 (working fine in v0.110.0)

What config did you use?
I updated my yaml as per: #11205 from:

service:
  telemetry:
    metrics:
      level: none
      address: ":8889"

to the following:

service:
  telemetry:
    metrics:
      level: none
      readers:
        - pull:
            exporter:
              prometheus:
                host: "localhost"
                port: 8889

but on gotest/gobuild, I then hit the above errors, also caught by go-analysis via golangci-lint

Environment
Ubuntu 22.04.5
go 1.23.2

Additional context
None

@mjnowen mjnowen added the bug Something isn't working label Oct 17, 2024
@mx-psi
Copy link
Member

mx-psi commented Oct 23, 2024

Hey, thanks for reporting, all tests are passing in our CI, would you mind giving more details about what command are you running and whether you are making any modifications to the code?

@mjnowen
Copy link
Author

mjnowen commented Oct 23, 2024

No modifications to the code have been made. I'm simply consuming this go package and running go build -o test and I hit this series of errors. I inspected this commit which is where I believe the problem originated: https://github.com/open-telemetry/opentelemetry-collector/pull/11205/files#diff-a653472ad3f971bd1d89e9a4a8fa77d4346feeb43da9cdfb71011d0bad520a67

If you look in the above commit, you should notice that I believe some files have not been updated, which are causing these errors. ../service/telemetry/config.go was updated, but I believe ../service/telemetry/internal/otelinit/config.go was missed, as this is the single file generating errors after this commit was merged. Also, I'm guessing ../service/telemetry/internal/otelinit/config_test.go should be updated accordingly as well.

Perhaps your CI isn't failing, because the above _test.go hasn't been updated as well and passes, because its testing against a file which also hasn't been updated?

# go.opentelemetry.io/collector/service/telemetry/internal/otelinit
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.112.0/telemetry/internal/otelinit/config.go:169:39: undefined: config.MetricExporter
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.112.0/telemetry/internal/otelinit/config.go:176:64: undefined: config.MetricExporter
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.112.0/telemetry/internal/otelinit/config.go:218:9: invalid argument: otlpConfig.Endpoint (variable of type *string) for built-in len
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.112.0/telemetry/internal/otelinit/config.go:219:51: cannot use otlpConfig.Endpoint (variable of type *string) as string value in argument to normalizeEndpoint
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.112.0/telemetry/internal/otelinit/config.go:243:50: cannot use otlpConfig.Headers (variable of type []config.NameStringValuePair) as map[string]string value in argument to otlpmetricgrpc.WithHeaders
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.112.0/telemetry/internal/otelinit/config.go:264:9: invalid argument: otlpConfig.Endpoint (variable of type *string) for built-in len
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.112.0/telemetry/internal/otelinit/config.go:265:51: cannot use otlpConfig.Endpoint (variable of type *string) as string value in argument to normalizeEndpoint
../../../.go/pkg/mod/go.opentelemetry.io/collector/service@v0.112.0/telemetry/internal/otelinit/config.go:[292](https://gitlab.aws.dev/visual-compute/knfsd-file-cache/-/jobs/10850409#L292):50: cannot use otlpConfig.Headers (variable of type []config.NameStringValuePair) as map[string]string value in argument to otlpmetrichttp.WithHeaders

@mjnowen
Copy link
Author

mjnowen commented Oct 23, 2024

Another example of a CI command that fails:

Command:
$ golangci-lint run --config="${CI_PROJECT_DIR}/.golangci.yaml" --verbose
Error:
level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package otelinit: could not load export data: no export data for \"go.opentelemetry.io/collector/service/telemetry/internal/otelinit\""

@bogdandrutu
Copy link
Member

I expect this is caused by a transitive dependency. What version of the go.opentelemetry.io/contrib/config do you use? If it is 0.11.0 you need to downgrade that to 0.10.0. I think the PR you linked is not the problem, but the problem is this package that made backwards incompatible changes.

@mjnowen
Copy link
Author

mjnowen commented Oct 23, 2024

Thanks for the advice. Adding this line to my go.mod fixes the issue:

replace go.opentelemetry.io/contrib/config v0.11.0 => go.opentelemetry.io/contrib/config v0.10.0

So, is the solution here to leave this replace in place until such time that v0.12.0 is released?

@bogdandrutu
Copy link
Member

They will probably not fix the breaking and will keep it. What will happen is we need to adopt our code to use the new version.

Closing this, since this is expected per the situation described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants