From 4ddf4e1c49221eb35ba14d5a9d7cdb24a6641227 Mon Sep 17 00:00:00 2001 From: Dustin Ngo Date: Thu, 22 Aug 2024 18:48:29 -0400 Subject: [PATCH 1/2] Improve URL encoding logic --- packages/phoenix-otel/src/phoenix/otel/settings.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/phoenix-otel/src/phoenix/otel/settings.py b/packages/phoenix-otel/src/phoenix/otel/settings.py index 8e25a0dc94..08077a826b 100644 --- a/packages/phoenix-otel/src/phoenix/otel/settings.py +++ b/packages/phoenix-otel/src/phoenix/otel/settings.py @@ -59,20 +59,19 @@ def parse_env_headers(s: str) -> Dict[str, str]: match = _HEADER_PATTERN.fullmatch(header.strip()) if not match: parts = header.split("=", 1) - if len(parts) == 2: - name, value = parts - encoded_header = f"{urllib.parse.quote(name)}={urllib.parse.quote(value)}" + name, value = parts + encoded_header = f"{urllib.parse.quote(name)}={urllib.parse.quote(value)}" match = _HEADER_PATTERN.fullmatch(encoded_header.strip()) if not match: _logger.warning( "Header format invalid! Header values in environment variables must be " "URL encoded: %s", - header, + f"{name}: ****", ) continue _logger.warning( - f"Header values in environment variables should be URL encoded, ``{header}`` " - f"was urlencoded to: ``{encoded_header}``" + "Header values in environment variables should be URL encoded, attempting to " + "URL encode header: {name}: ****" ) name, value = header.split("=", 1) From 8fc26db45c6c78c215b355c79cf4fc3bf85e7f27 Mon Sep 17 00:00:00 2001 From: Dustin Ngo Date: Thu, 22 Aug 2024 19:30:20 -0400 Subject: [PATCH 2/2] Properly initialize GRPC exporter --- packages/phoenix-otel/src/phoenix/otel/otel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/phoenix-otel/src/phoenix/otel/otel.py b/packages/phoenix-otel/src/phoenix/otel/otel.py index 900074bb54..5030f813a9 100644 --- a/packages/phoenix-otel/src/phoenix/otel/otel.py +++ b/packages/phoenix-otel/src/phoenix/otel/otel.py @@ -227,7 +227,7 @@ def __init__(self, *args: Any, **kwargs: Any): if bound_args.arguments.get("endpoint") is None: _, endpoint = _normalized_endpoint(None) bound_args.arguments["endpoint"] = endpoint - super().__init__(*args, **kwargs) + super().__init__(**bound_args.arguments) def _maybe_http_endpoint(parsed_endpoint: ParseResult) -> bool: