diff --git a/shared/monitoring/otel_config.py b/shared/monitoring/otel_config.py index 9d66b017..66e42b11 100644 --- a/shared/monitoring/otel_config.py +++ b/shared/monitoring/otel_config.py @@ -157,6 +157,30 @@ class OTelConfig: return endpoint + @classmethod + def _clean_and_validate_grpc_endpoint(cls, endpoint: str) -> str: + """ + Clean and validate a gRPC endpoint. + + Args: + endpoint: Raw endpoint string + + Returns: + Cleaned and validated endpoint in format "host:port" + """ + # First clean the endpoint + cleaned = cls._clean_grpc_endpoint(endpoint) + + # Validate it doesn't contain secret references + if cls._contains_secret_reference(cleaned): + logger.warning( + "Endpoint contains secret reference, using default", + original=endpoint + ) + return f"{cls.DEFAULT_OTEL_COLLECTOR_HOST}:{cls.DEFAULT_GRPC_PORT}" + + return cleaned + @staticmethod def _extract_host(endpoint: str) -> str: """