Skip to content

Commit 41f166e

Browse files
committed
Add debug logging for SPOG x-databricks-org-id header extraction
Mirrors the JDBC driver's logging pattern. Emits at DEBUG level in three code paths of _extract_spog_headers: 1. http_path has a query string but no ?o= param — log and skip. 2. x-databricks-org-id already set by the caller (via http_headers) — log and skip (don't override explicit user header). 3. Injection happens — log the extracted workspace ID so customers diagnosing SPOG routing can confirm the header was added. Helps with customer support: when a customer reports "SPOG isn't routing correctly", they can enable DEBUG logging and immediately see whether the connector saw their ?o= value. Signed-off-by: Madhavendra Rathore Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
1 parent c3e7920 commit 41f166e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/databricks/sql/session.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,26 @@ def _extract_spog_headers(http_path, existing_headers):
156156
params = parse_qs(query_string)
157157
org_id = params.get("o", [None])[0]
158158
if not org_id:
159+
logger.debug(
160+
"SPOG header extraction: http_path has query string but no ?o= param, "
161+
"skipping x-databricks-org-id injection"
162+
)
159163
return {}
160164

161165
# Don't override if explicitly set
162166
if any(k == "x-databricks-org-id" for k, _ in existing_headers):
167+
logger.debug(
168+
"SPOG header extraction: x-databricks-org-id already set by caller, "
169+
"not overriding with ?o=%s from http_path",
170+
org_id,
171+
)
163172
return {}
164173

174+
logger.debug(
175+
"SPOG header extraction: injecting x-databricks-org-id=%s "
176+
"(extracted from ?o= in http_path)",
177+
org_id,
178+
)
165179
return {"x-databricks-org-id": org_id}
166180

167181
def get_spog_headers(self):

0 commit comments

Comments
 (0)