Skip to content

Collector cannot export metrics telemetry in an ipv6-only environment #10011

Description

@lpetrazickisupgrade

Describe the bug

  1. Expose telemetry metrics for OpenTelemetry Collector with a correctly escaped ipv6 ip address
  2. Collector unescapes the ip address and naively concatenates it with the port number
  3. Too many colons error

Steps to reproduce

  1. Delimit the ipv6 address with square brackets:
service:
  telemetry:
    logs:
      encoding: json
    metrics:
      address: '[${env:MY_POD_IP}]:8888'
  1. Deploy config to an ipv6-only environment
  2. listen tcp: address dead:beef:dead:beef:dead::beef:8888: too many colons in address

What did you expect to see?
Metrics on port 8888

What did you see instead?

{
  "level": "error",
  "ts": 1713554862.2179377,
  "caller": "otelcol@v0.98.0/collector.go:275",
  "msg": "Asynchronous error received, terminating process",
  "error": "listen tcp: address dead:beef:dead:beef:dead::beef:8888: too many colons in address",
  "stacktrace": "
go.opentelemetry.io/collector/otelcol.(*Collector).Run
    go.opentelemetry.io/collector/otelcol@v0.98.0/collector.go:275
go.opentelemetry.io/collector/otelcol.NewCommand.func1
    go.opentelemetry.io/collector/otelcol@v0.98.0/command.go:35
github.com/spf13/cobra.(*Command).execute
    github.com/spf13/cobra@v1.8.0/command.go:983
github.com/spf13/cobra.(*Command).ExecuteC
    github.com/spf13/cobra@v1.8.0/command.go:1115
github.com/spf13/cobra.(*Command).Execute
    github.com/spf13/cobra@v1.8.0/command.go:1039
main.runInteractive
    github.com/open-telemetry/opentelemetry-collector-releases/contrib/main.go:27
main.run
    github.com/open-telemetry/opentelemetry-collector-releases/contrib/main_others.go:10
main.main
    github.com/open-telemetry/opentelemetry-collector-releases/contrib/main.go:20
runtime.main
    runtime/proc.go:271"
}

What version did you use?
v0.98.0

What config did you use?

service:
  telemetry:
    logs:
      encoding: json
    metrics:
      address: '[${env:MY_POD_IP}]:8888'

Environment
helm.sh/chart: opentelemetry-collector-0.87.2
Image: opentelemetry-collector-contrib:0.98.0
Kubernetes: v1.29.1-eks-b9c9ed7

Additional context
This is a regression. v0.79.0 did not have this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcollector-telemetryhealthchecker and other telemetry collection issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions