Skip to content

Commit 2dd401e

Browse files
Add telemetry to track use of experimental.use_legacy_run_as (#3321)
## Why Since we'll soon be adding support for run_as for DLT pipelines we can remove support for the legacy mode. #3307 Tracking usage will inform us of the impact from removing this option. ## Tests New test and existing ones.
1 parent 092c8da commit 2dd401e

File tree

10 files changed

+99
-0
lines changed

10 files changed

+99
-0
lines changed

acceptance/bundle/paths/fallback_metric/output.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Deployment complete!
1414

1515
>>> cat out.requests.txt
1616
[
17+
{
18+
"key": "experimental.use_legacy_run_as",
19+
"value": false
20+
},
1721
{
1822
"key": "presets_name_prefix_is_set",
1923
"value": false
@@ -40,6 +44,10 @@ Deployment complete!
4044
}
4145
]
4246
[
47+
{
48+
"key": "experimental.use_legacy_run_as",
49+
"value": false
50+
},
4351
{
4452
"key": "presets_name_prefix_is_set",
4553
"value": false

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Deployment complete!
1313

1414
>>> cat out.requests.txt
1515
[
16+
{
17+
"key": "experimental.use_legacy_run_as",
18+
"value": false
19+
},
1620
{
1721
"key": "presets_name_prefix_is_set",
1822
"value": false
@@ -39,6 +43,10 @@ Deployment complete!
3943
}
4044
]
4145
[
46+
{
47+
"key": "experimental.use_legacy_run_as",
48+
"value": false
49+
},
4250
{
4351
"key": "presets_name_prefix_is_set",
4452
"value": false
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
experimental:
2+
use_legacy_run_as: true
3+
4+
run_as:
5+
user_name: abcd
6+
7+
resources:
8+
jobs:
9+
foo:
10+
tasks:
11+
- task_key: task1
12+
spark_python_task:
13+
python_file: /Workspace/test.py
14+
existing_cluster_id: hjkl
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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
>>> [CLI] bundle deploy
3+
Warning: You are using the legacy mode of run_as. The support for this mode is experimental and might be removed in a future release of the CLI. In order to run the DLT pipelines in your DAB as the run_as user this mode changes the owners of the pipelines to the run_as identity, which requires the user deploying the bundle to be a workspace admin, and also a Metastore admin if the pipeline target is in UC.
4+
at experimental.use_legacy_run_as
5+
in databricks.yml:4:22
6+
7+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
8+
Deploying resources...
9+
Updating deployment state...
10+
Deployment complete!
11+
12+
>>> cat out.requests.txt
13+
{
14+
"bool_values": [
15+
{
16+
"key": "experimental.use_legacy_run_as",
17+
"value": true
18+
},
19+
{
20+
"key": "presets_name_prefix_is_set",
21+
"value": false
22+
},
23+
{
24+
"key": "skip_artifact_cleanup",
25+
"value": false
26+
},
27+
{
28+
"key": "python_wheel_wrapper_is_set",
29+
"value": false
30+
},
31+
{
32+
"key": "has_serverless_compute",
33+
"value": false
34+
},
35+
{
36+
"key": "has_classic_job_compute",
37+
"value": false
38+
},
39+
{
40+
"key": "has_classic_interactive_compute",
41+
"value": true
42+
}
43+
]
44+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
trace $CLI bundle deploy
2+
3+
trace cat out.requests.txt | jq 'select(has("path") and .path == "/telemetry-ext") | .body.protoLogs[] | fromjson | .entry.databricks_cli_log.bundle_deploy_event.experimental | {bool_values}'
4+
5+
rm out.requests.txt

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Deployment complete!
88
>>> cat out.requests.txt
99
{
1010
"bool_values": [
11+
{
12+
"key": "experimental.use_legacy_run_as",
13+
"value": false
14+
},
1115
{
1216
"key": "presets_name_prefix_is_set",
1317
"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
@@ -8,6 +8,10 @@ Deployment complete!
88
>>> cat out.requests.txt
99
{
1010
"bool_values": [
11+
{
12+
"key": "experimental.use_legacy_run_as",
13+
"value": false
14+
},
1115
{
1216
"key": "presets_name_prefix_is_set",
1317
"value": true

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"lookup_variable_count": 0,
4343
"target_count": 1,
4444
"bool_values": [
45+
{
46+
"key": "experimental.use_legacy_run_as",
47+
"value": false
48+
},
4549
{
4650
"key": "presets_name_prefix_is_set",
4751
"value": false

bundle/config/mutator/resourcemutator/run_as.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ func setPipelineOwnersToRunAsIdentity(b *bundle.Bundle) {
181181
}
182182

183183
func (m *setRunAs) Apply(_ context.Context, b *bundle.Bundle) diag.Diagnostics {
184+
// Track the use of the legacy run_as mode.
185+
b.Metrics.AddBoolValue("experimental.use_legacy_run_as", b.Config.Experimental != nil && b.Config.Experimental.UseLegacyRunAs)
186+
184187
// Mutator is a no-op if run_as is not specified in the bundle
185188
if b.Config.Value().Get("run_as").Kind() == dyn.KindInvalid {
186189
return nil

0 commit comments

Comments
 (0)