Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lite_bootstrap/instruments/opentelemetry_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def _parse_remote_insecure_host(self, endpoint: str | None) -> str | None:
if "://" not in raw:
raw = f"//{raw}"
parsed = urllib.parse.urlparse(raw)
# The gRPC exporter forces TLS for https whatever insecure says.
if parsed.scheme == "https":
return None
host = (parsed.hostname or "").lower()
if host in _LOCAL_HOSTS:
return None
Expand Down
7 changes: 7 additions & 0 deletions tests/instruments/test_opentelemetry_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ def test_opentelemetry_config_no_warning_for_local_endpoints(endpoint: str) -> N
OpenTelemetryConfig(opentelemetry_endpoint=endpoint, opentelemetry_insecure=True)


@pytest.mark.parametrize("endpoint", ["https://collector.example.com:4317", "HTTPS://collector.example.com:4317"])
def test_opentelemetry_config_no_warning_for_https_endpoints(endpoint: str) -> None:
with warnings.catch_warnings():
warnings.simplefilter("error")
OpenTelemetryConfig(opentelemetry_endpoint=endpoint, opentelemetry_metrics_endpoint=endpoint)


@pytest.mark.parametrize(
"endpoint",
[
Expand Down
Loading