1fanwang opened a new pull request, #66813:
URL: https://github.com/apache/airflow/pull/66813
### Problem
`get_otel_data_exporter()` builds the OTLP exporter endpoint URL with a raw
f-string:
```python
endpoint_str = f"{protocol}://{host}:{port}/v1/{endpoint_suffix}"
```
When `host` is an IPv6 literal (e.g. `::1`, `2001:db8::1`), the resulting
URL is invalid per RFC 3986 §3.2.2 — the v6 host has to be enclosed in `[...]`
so the `:` separators don't conflict with the `host:port` delimiter:
```
http://::1:4318/v1/metrics # invalid
http://2001:db8::1:4318/v1/metrics # invalid
```
The OTLP exporter then either fails to parse the URL or interprets the
trailing port digits as part of the v6 address.
### Fix
Add a small `_format_url_host()` helper in
`shared/observability/.../common.py` that brackets bare IPv6 literals and
leaves hostnames, IPv4 literals, and already-bracketed v6 strings unchanged.
The helper accepts `str | None` so the existing error-logging path (where the
deprecated airflow host/port config can resolve to `None`) keeps its shape.
### Tests
Extended `test_config_priorities` with four new parametrised cases:
- `::1` → `http://[::1]:4318/v1/metrics`
- `2001:db8::1` → `http://[2001:db8::1]:4318/v1/metrics`
- `[::1]` (already bracketed) → preserved
- `10.0.0.1` (v4) → passes through unchanged
Closes #66811
--
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]