You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "nija-at (via GitHub)" <gi...@apache.org> on 2023/07/06 05:02:36 UTC

[GitHub] [spark] nija-at commented on a diff in pull request #41866: [SPARK-44312][CONNECT][PYTHON] Allow to set a user agent with an environment variable

nija-at commented on code in PR #41866:
URL: https://github.com/apache/spark/pull/41866#discussion_r1253932386


##########
python/pyspark/sql/connect/client/core.py:
##########
@@ -296,7 +296,10 @@ def userAgent(self) -> str:
             or "_SPARK_CONNECT_PYTHON" when not specified.
             The returned value will be percent encoded.
         """
-        user_agent = self.params.get(ChannelBuilder.PARAM_USER_AGENT, "_SPARK_CONNECT_PYTHON")
+        user_agent = self.params.get(
+            ChannelBuilder.PARAM_USER_AGENT,
+            os.getenv("SPARK_CONNECT_USER_AGENT", "_SPARK_CONNECT_PYTHON"),

Review Comment:
   Would like to call this `SPARK_CONNECT_USER_AGENT_EXTRA`. 
   
   @grundprinzip - Is that acceptable to you?



##########
python/pyspark/sql/connect/client/core.py:
##########
@@ -296,7 +296,10 @@ def userAgent(self) -> str:
             or "_SPARK_CONNECT_PYTHON" when not specified.
             The returned value will be percent encoded.
         """
-        user_agent = self.params.get(ChannelBuilder.PARAM_USER_AGENT, "_SPARK_CONNECT_PYTHON")
+        user_agent = self.params.get(
+            ChannelBuilder.PARAM_USER_AGENT,
+            os.getenv("SPARK_CONNECT_USER_AGENT", "_SPARK_CONNECT_PYTHON"),

Review Comment:
   The value of the env var needs to be appended to the existing user agent, not replaced.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org