Commit 86ccb6e
authored
Add X-Databricks-Org-Id header to telemetry API calls for SPOG hosts (#5099)
## Why
SPOG hosts serve multiple workspaces from a single URL and require the
`X-Databricks-Org-Id` header to route requests to the correct workspace.
Without it, telemetry recorded by `/telemetry-ext` lands in a central
shard rather than the user's workspace.
The CLI's telemetry code makes a direct `apiClient.Do()` call to
`/telemetry-ext` that bypasses the SDK's generated service methods
(which set this header from `cfg.WorkspaceID`) and was passing `nil` for
headers.
This mirrors the fix already applied for filer in #4985. SDK PR
databricks/databricks-sdk-go#1634 only patched `Workspace.Download()` /
`Workspace.Upload()`; it is not a transport-level visitor, so direct
`apiClient.Do()` callers in the CLI still need to set the header
explicitly.
## Changes
- `libs/telemetry/logger.go`: add `orgIDHeaders(apiClient)` helper that
returns `{"X-Databricks-Org-Id": cfg.WorkspaceID}` when set, `nil`
otherwise; pass it to `apiClient.Do()` in `attempt()`.
- `acceptance/telemetry/test.toml`: append `X-Databricks-Org-Id` to
`IncludeRequestHeaders` so the existing telemetry acceptance tests
capture the header on `POST /telemetry-ext`. The header value is
resolved from `.well-known/databricks-config` via the SDK and now flows
into the recorded request, giving end-to-end coverage.
## Test plan
- [x] `go test ./acceptance -run TestAccept/telemetry` passes;
`out.requests.txt` for success/partial-success/failure/timeout now
includes `X-Databricks-Org-Id`.
- [x] `go test ./libs/telemetry/...` passes.
This pull request was AI-assisted by Isaac.1 parent 80f7a54 commit 86ccb6e
6 files changed
Lines changed: 40 additions & 2 deletions
File tree
- acceptance/telemetry
- failure
- partial-success
- success
- timeout
- libs/telemetry
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
43 | 52 | | |
44 | 53 | | |
45 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
43 | 52 | | |
44 | 53 | | |
45 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
174 | 188 | | |
175 | 189 | | |
176 | | - | |
| 190 | + | |
177 | 191 | | |
178 | 192 | | |
179 | 193 | | |
| |||
0 commit comments