Skip to content

Commit 390d53e

Browse files
Add telemetry tracking for top-level run_as configuration (#3542)
## Summary This PR adds telemetry tracking to measure when the top-level `run_as` configuration is set in Databricks Asset Bundles. ## Changes - **Telemetry**: Added `run_as_set` boolean field that tracks whether top-level `run_as` is configured - **Tests**: Added acceptance test to verify telemetry correctly reports `true` when `run_as` is set - **Coverage**: Updated existing deploy test to include the new telemetry field (covers the `false` case) The new telemetry field appears alongside existing boolean telemetry like `experimental.use_legacy_run_as` and will help measure adoption of the top-level `run_as` feature. ## Test Plan - ✅ Unit tests pass for the resourcemutator package - ✅ New acceptance test verifies telemetry reports `true` when `run_as` is set - ✅ Existing deploy test continues to pass and reports `false` when `run_as` is not set 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <[email protected]>
1 parent 3c03fdd commit 390d53e

File tree

11 files changed

+66
-0
lines changed

11 files changed

+66
-0
lines changed

acceptance/bundle/telemetry/deploy-compute-type/output.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Deployment complete!
1717
"key": "experimental.use_legacy_run_as",
1818
"value": false
1919
},
20+
{
21+
"key": "run_as_set",
22+
"value": false
23+
},
2024
{
2125
"key": "presets_name_prefix_is_set",
2226
"value": false
@@ -47,6 +51,10 @@ Deployment complete!
4751
"key": "experimental.use_legacy_run_as",
4852
"value": false
4953
},
54+
{
55+
"key": "run_as_set",
56+
"value": false
57+
},
5058
{
5159
"key": "presets_name_prefix_is_set",
5260
"value": false

acceptance/bundle/telemetry/deploy-experimental/output.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Deployment complete!
1616
"key": "experimental.use_legacy_run_as",
1717
"value": true
1818
},
19+
{
20+
"key": "run_as_set",
21+
"value": true
22+
},
1923
{
2024
"key": "presets_name_prefix_is_set",
2125
"value": false

acceptance/bundle/telemetry/deploy-name-prefix/custom/output.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Deployment complete!
1212
"key": "experimental.use_legacy_run_as",
1313
"value": false
1414
},
15+
{
16+
"key": "run_as_set",
17+
"value": false
18+
},
1519
{
1620
"key": "presets_name_prefix_is_set",
1721
"value": true

acceptance/bundle/telemetry/deploy-name-prefix/mode-development/output.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Deployment complete!
1212
"key": "experimental.use_legacy_run_as",
1313
"value": false
1414
},
15+
{
16+
"key": "run_as_set",
17+
"value": false
18+
},
1519
{
1620
"key": "presets_name_prefix_is_set",
1721
"value": true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
run_as:
2+
service_principal_name: "sp_test"
3+
4+
resources:
5+
jobs:
6+
test_job:
7+
name: Test Job
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
>>> [CLI] bundle deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
>>> cat out.requests.txt
9+
10+
>>> cat telemetry.json
11+
{
12+
"key": "run_as_set",
13+
"value": true
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trace $CLI bundle deploy
2+
3+
trace cat out.requests.txt | jq 'select(has("path") and .path == "/telemetry-ext") | .body.protoLogs[] | fromjson' > telemetry.json
4+
5+
trace cat telemetry.json | jq '.entry.databricks_cli_log.bundle_deploy_event.experimental.bool_values[] | select(.key == "run_as_set")'
6+
7+
rm out.requests.txt
8+
rm telemetry.json
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]

acceptance/bundle/telemetry/deploy/out.telemetry.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
"key": "experimental.use_legacy_run_as",
4747
"value": false
4848
},
49+
{
50+
"key": "run_as_set",
51+
"value": false
52+
},
4953
{
5054
"key": "presets_name_prefix_is_set",
5155
"value": false

0 commit comments

Comments
 (0)