1fanwang opened a new issue, #66811:
URL: https://github.com/apache/airflow/issues/66811

   ### Apache Airflow version
   
   main (development)
   
   ### What happened?
   
   `get_otel_data_exporter()` in 
`shared/observability/src/airflow_shared/observability/common.py` builds the 
OTLP exporter endpoint URL with a raw f-string:
   
   ```python
   endpoint_str = f"{protocol}://{host}:{port}/v1/{endpoint_suffix}"
   ```
   
   If `host` is an IPv6 literal (e.g. `::1`, `2001:db8::1`), the resulting URL 
is invalid per RFC 3986 §3.2.2:
   
   ```
   http://::1:4318/v1/metrics              # invalid — needs 
http://[::1]:4318/...
   http://2001:db8::1:4318/v1/metrics      # invalid — needs 
http://[2001:db8::1]:4318/...
   ```
   
   The OTLP exporter then either fails to parse the URL or interprets the 
trailing port digits as part of the v6 address.
   
   ### What you think should happen instead?
   
   Bracket IPv6 host literals before concatenating with the port. RFC 3986 
§3.2.2 requires `[...]` around v6 hosts in the URI authority.
   
   ### How to reproduce
   
   Set the OTel collector host to a literal IPv6 address (via 
`OTEL_EXPORTER_OTLP_ENDPOINT_HOST=::1` and the corresponding port var, or the 
deprecated `[metrics] otel_host = ::1` config option), enable OTel metrics, and 
observe the exporter fails to reach the collector.
   
   ### Anything else?
   
   Affects deployments where the collector is reachable only via IPv6 — 
uncommon today but growing as IPv6-only k8s networks become more common.
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's Code of Conduct
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to