Uploaded image for project: 'Distributed Tracing'
  1. Distributed Tracing
  2. TRACING-5823

[RHOSDT 3.8] OpenTelemetry operator: parse exporter and receiver (e.g. Prometheus) ports

XMLWordPrintable

      When configuring a Prometheus receiver and trying to enable the API endpoint for it like

           prometheus:
              api_server:
                enabled: true
                server_config:
                  endpoint: "0.0.0.0:9091"
              config:
                scrape_configs:
                  ... 

      neither a service get's added to the otc service definition nore the network policy reflects the port 

      $ oc -n hackaton get service otel3-collector 
      NAME              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
      otel3-collector   ClusterIP   172.31.146.45   <none>        9090/TCP   20m
      
      $ oc -n hackaton get networkpolicy otel3-collector-networkpolicy -o yaml | yq -ry .spec
      ingress:
        - ports:
            - port: 8888
              protocol: TCP
            - port: 9090
              protocol: TCP
      podSelector:
        matchLabels:
          app.kubernetes.io/component: opentelemetry-collector
          app.kubernetes.io/instance: hackaton.otel3
          app.kubernetes.io/managed-by: opentelemetry-operator
          app.kubernetes.io/part-of: opentelemetry
      policyTypes:
        - Ingress

      Testing to use the existing port of the endpoint in that definition causes another uncaught exception

      2025-11-24T18:23:05.735Z error prometheusreceiver@v0.140.1/metrics_receiver.go:129 Failed to initAPIServer {"resource": {"service.instance.id": "b87cf373-75c7-46b8-a9f8-cfcdb39e08df", "service.name": "otelcol", "service.version": "0.140.1"}, "otelcol.component.id": "prometheus", "otelcol.component.kind": "receiver", "otelcol.signal": "metrics", "error": "failed to create listener: listen tcp 0.0.0.0:9090: bind: address already in use"}github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver.(*pReceiver).Startgithub.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver@v0.140.1/metrics_receiver.go:129go.opentelemetry.io/collector/service/internal/graph.(*Graph).StartAllgo.opentelemetry.io/collector/service@v0.140.0/internal/graph/graph.go:432go.opentelemetry.io/collector/service.(*Service).Startgo.opentelemetry.io/collector/service@v0.140.0/service.go:239go.opentelemetry.io/collector/otelcol.(*Collector).setupConfigurationComponentsgo.opentelemetry.io/collector/otelcol@v0.140.0/collector.go:245go.opentelemetry.io/collector/otelcol.(*Collector).Rungo.opentelemetry.io/collector/otelcol@v0.140.0/collector.go:317go.opentelemetry.io/collector/otelcol.NewCommand.func1go.opentelemetry.io/collector/otelcol@v0.140.0/command.go:39github.com/spf13/cobra.(*Command).executegithub.com/spf13/cobra@v1.10.1/command.go:1015github.com/spf13/cobra.(*Command).ExecuteCgithub.com/spf13/cobra@v1.10.1/command.go:1148github.com/spf13/cobra.(*Command).Executegithub.com/spf13/cobra@v1.10.1/command.go:1071main.runInteractivegithub.com/os-observability/redhat-opentelemetry-collector/main.go:58main.rungithub.com/os-observability/redhat-opentelemetry-collector/main_others.go:10main.maingithub.com/os-observability/redhat-opentelemetry-collector/main.go:51runtime.mainruntime/proc.go:283 

              Unassigned Unassigned
              rhn-support-milang Michaela Lang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: