Repository navigation
Record the real error in config-remote-sync telemetry #7720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ilyakuz-db
wants to merge
14
commits into
main
Choose a base branch
from
ilyakuz-db/configsync-telemetry-real-error
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+355
−1
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5d22415
Record the real error in config-remote-sync telemetry
ilyakuz-db 965f9d3
Apply the profile flag before resolving auth after a target failure
ilyakuz-db e1c78e0
Skip the auth fallback when a target sets its own workspace
ilyakuz-db d22d823
Report target-load failures only with an explicit profile
ilyakuz-db f8db888
Report a missing bundle with an explicit profile too
ilyakuz-db 98ad375
Skip the profile fallback when the profile conflicts with the bundle …
ilyakuz-db b2b792e
Resolve the telemetry auth fallback from the profile alone
ilyakuz-db a153117
Use withdir for the host conflict case
ilyakuz-db 6598098
Bound the profile fallback, skip it when telemetry is disabled, and c…
ilyakuz-db 8c31810
Skip the fallback on bundle auth errors, use the selected target's ho…
ilyakuz-db 1d903da
Log the remaining fallback skips and cover DATABRICKS_BUNDLE_TARGET
ilyakuz-db 6277854
Let the telemetry upload resolve the profile fallback and read the pr…
ilyakuz-db 7eb3860
Let the profile win over auth env vars in the telemetry fallback
ilyakuz-db 4f09cc0
Skip the telemetry fallback for a profile on another workspace of the…
ilyakuz-db File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
acceptance/bundle/telemetry/config-remote-sync-error-message/conflict/databricks.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bundle: | ||
| name: config-remote-sync-telemetry-host-conflict | ||
|
|
||
| workspace: | ||
| host: https://other.test | ||
|
|
||
| targets: | ||
| bad: | ||
| variables: | ||
| undefined_var: value | ||
| own-host: | ||
| workspace: | ||
| host: $DATABRICKS_HOST | ||
| variables: | ||
| undefined_var: value |
21 changes: 21 additions & 0 deletions
21
acceptance/bundle/telemetry/config-remote-sync-error-message/databricks.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| bundle: | ||
| name: config-remote-sync-telemetry-error-message | ||
|
|
||
| variables: | ||
| myvar: | ||
| description: a required variable | ||
|
|
||
| targets: | ||
| dev: | ||
| default: true | ||
| bad: | ||
| variables: | ||
| undefined_var: value | ||
| other: | ||
| workspace: | ||
| host: https://other.test | ||
| variables: | ||
| undefined_var: value | ||
| auth-error: | ||
| workspace: | ||
| client_id: x |
11 changes: 11 additions & 0 deletions
11
acceptance/bundle/telemetry/config-remote-sync-error-message/default-target/databricks.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| bundle: | ||
| name: config-remote-sync-telemetry-default-target | ||
|
|
||
| targets: | ||
| bad: | ||
| default: true | ||
| variables: | ||
| undefined_var: value | ||
| other: | ||
| workspace: | ||
| host: https://other.test |
16 changes: 16 additions & 0 deletions
16
acceptance/bundle/telemetry/config-remote-sync-error-message/other-workspace/databricks.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| bundle: | ||
| name: config-remote-sync-telemetry-other-workspace | ||
|
|
||
| workspace: | ||
| host: $DATABRICKS_HOST | ||
| workspace_id: "1111" | ||
|
|
||
| targets: | ||
| bad: | ||
| variables: | ||
| undefined_var: value | ||
| profile-workspace: | ||
| workspace: | ||
| workspace_id: "2222" | ||
| variables: | ||
| undefined_var: value |
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/telemetry/config-remote-sync-error-message/out.test.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Cloud = false | ||
| GOOS.windows = false | ||
| EnvMatrix.DMS = [""] |
115 changes: 115 additions & 0 deletions
115
acceptance/bundle/telemetry/config-remote-sync-error-message/output.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync | ||
| Error: no value assigned to required variable myvar. Variables are usually assigned in databricks.yml, and they can be overridden using "--var", the BUNDLE_VAR_myvar environment variable, or .databricks/bundle/<target>/variable-overrides.json | ||
|
|
||
|
|
||
| >>> print_requests.py //telemetry-ext | ||
| { | ||
| "error_message": "no value assigned to required variable myvar. Variables are usually assigned in databricks.yml, and they can be overridden using \"--var\", the BUNDLE_VAR_myvar environment variable, or [REDACTED_REL_PATH](json)", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t bad -p myprofile | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> print_requests.py //telemetry-ext | ||
| { | ||
| "error_message": "failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t bad | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t bad -p myprofile | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t bad -p myprofile | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t own-host -p myprofile | ||
| Error: failed to perform target override for target=own-host: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t profile-workspace -p workspace2222 | ||
| Error: failed to perform target override for target=profile-workspace: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -p myprofile | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> print_requests.py //telemetry-ext | ||
| { | ||
| "error_message": "failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
| { | ||
| "error_message": "failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
| { | ||
| "error_message": "failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
| { | ||
| "error_message": "failed to perform target override for target=own-host: variable undefined_var is not defined but is assigned a value", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
| { | ||
| "error_message": "failed to perform target override for target=profile-workspace: variable undefined_var is not defined but is assigned a value", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
| { | ||
| "error_message": "failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -p myprofile | ||
| Error: Invalid bundle root DATABRICKS_BUNDLE_ROOT="missing": stat missing: no such file or directory | ||
|
|
||
| The DATABRICKS_BUNDLE_ROOT environment variable must point to an existing directory that contains a bundle configuration file. | ||
|
|
||
|
|
||
| >>> print_requests.py //telemetry-ext | ||
| { | ||
| "error_message": "Invalid bundle root DATABRICKS_BUNDLE_ROOT=\"missing\": stat missing: no such file or directory", | ||
| "error_category": "BUNDLE_LOAD_FAILED" | ||
| } | ||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t bad | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t bad -p missing | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t bad -p myprofile | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t bad -p workspace2222 | ||
| Error: failed to perform target override for target=bad: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t other -p myprofile | ||
| Error: failed to perform target override for target=other: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -p myprofile | ||
| Error: failed to perform target override for target=other: variable undefined_var is not defined but is assigned a value | ||
|
|
||
|
|
||
| >>> musterr [CLI] bundle config-remote-sync -t auth-error -p myprofile | ||
| Error: cannot resolve bundle auth configuration: validate: more than one authorization method configured: oauth and pat. Config: host=[DATABRICKS_URL], token=***, profile=myprofile, config_file=[TEST_TMP_DIR]/.databrickscfg, client_id=x, databricks_cli_path=[CLI]. Env: DATABRICKS_HOST, DATABRICKS_TOKEN, DATABRICKS_CONFIG_FILE, DATABRICKS_CLI_PATH | ||
|
|
||
|
|
||
| >>> errcode print_requests.py //telemetry-ext | ||
| File [OUTPUT_DIR]/out.requests.txt not found | ||
|
|
||
| Exit code: 1 |
10 changes: 10 additions & 0 deletions
10
acceptance/bundle/telemetry/config-remote-sync-error-message/same-host/databricks.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| bundle: | ||
| name: config-remote-sync-telemetry-same-host | ||
|
|
||
| workspace: | ||
| host: $DATABRICKS_HOST | ||
|
|
||
| targets: | ||
| bad: | ||
| variables: | ||
| undefined_var: value |
53 changes: 53 additions & 0 deletions
53
acceptance/bundle/telemetry/config-remote-sync-error-message/script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # The diagnostic is already printed, so telemetry records it instead of the AlreadyPrinted sentinel. | ||
| trace musterr $CLI bundle config-remote-sync | ||
|
|
||
| trace print_requests.py //telemetry-ext | jq '.body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_config_remote_sync_event | {error_message, error_category}' | ||
|
|
||
| cat > .databrickscfg <<EOT | ||
| [myprofile] | ||
| host = $DATABRICKS_HOST | ||
| token = $DATABRICKS_TOKEN | ||
|
|
||
| [workspace2222] | ||
| host = $DATABRICKS_HOST | ||
| workspace_id = 2222 | ||
| token = $DATABRICKS_TOKEN | ||
| EOT | ||
| export DATABRICKS_CONFIG_FILE=$PWD/.databrickscfg | ||
|
|
||
| # Selecting the target fails before the auth config is set; with an explicit profile the failure is still reported. | ||
| trace musterr $CLI bundle config-remote-sync -t bad -p myprofile | ||
|
|
||
| trace print_requests.py //telemetry-ext | jq '.body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_config_remote_sync_event | {error_message, error_category}' | ||
|
|
||
| # So is one with the profile from DATABRICKS_CONFIG_PROFILE, one where the bundle's or the target's host is the | ||
| # profile's (also to the profile's host when DATABRICKS_HOST names another), one where the target's workspace on the | ||
| # same host is the profile's, and a default target next to a target on another host. | ||
| DATABRICKS_CONFIG_PROFILE=myprofile trace musterr $CLI bundle config-remote-sync -t bad | ||
| envsubst < same-host/databricks.yml > out && mv out same-host/databricks.yml | ||
| withdir same-host trace musterr $CLI bundle config-remote-sync -t bad -p myprofile | ||
| DATABRICKS_HOST=https://other.test withdir same-host trace musterr $CLI bundle config-remote-sync -t bad -p myprofile | ||
| envsubst < conflict/databricks.yml > out && mv out conflict/databricks.yml | ||
| withdir conflict trace musterr $CLI bundle config-remote-sync -t own-host -p myprofile | ||
| envsubst < other-workspace/databricks.yml > out && mv out other-workspace/databricks.yml | ||
| withdir other-workspace trace musterr $CLI bundle config-remote-sync -t profile-workspace -p workspace2222 | ||
| withdir default-target trace musterr $CLI bundle config-remote-sync -p myprofile | ||
|
|
||
| trace print_requests.py //telemetry-ext | jq '.body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_config_remote_sync_event | {error_message, error_category}' | ||
|
|
||
| # So is a bundle that is not found at all. | ||
| DATABRICKS_BUNDLE_ROOT=missing trace musterr $CLI bundle config-remote-sync -p myprofile | ||
|
|
||
| trace print_requests.py //telemetry-ext | jq '.body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_config_remote_sync_event | {error_message, error_category}' | ||
|
|
||
| # Without a profile, with one that does not resolve, with one for another host than the bundle's or the target's | ||
| # or for another workspace on the bundle's host, or when the bundle's own auth fails, nothing is sent. | ||
| trace musterr $CLI bundle config-remote-sync -t bad | ||
| trace musterr $CLI bundle config-remote-sync -t bad -p missing | ||
| withdir conflict trace musterr $CLI bundle config-remote-sync -t bad -p myprofile | ||
| withdir other-workspace trace musterr $CLI bundle config-remote-sync -t bad -p workspace2222 | ||
| trace musterr $CLI bundle config-remote-sync -t other -p myprofile | ||
| DATABRICKS_BUNDLE_TARGET=other trace musterr $CLI bundle config-remote-sync -p myprofile | ||
| trace musterr $CLI bundle config-remote-sync -t auth-error -p myprofile | ||
|
|
||
| trace errcode print_requests.py //telemetry-ext | ||
5 changes: 5 additions & 0 deletions
5
acceptance/bundle/telemetry/config-remote-sync-error-message/test.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # config-remote-sync is not supported on Windows. | ||
| GOOS.windows = false | ||
|
|
||
| # The script writes .databrickscfg. | ||
| Ignore = [".databrickscfg"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.