Skip to content

Commit ffe6723

Browse files
Track number of YAML configuration files in a bundle (#2589)
## Why Tracking the distribution of number of YAML files in an bundle is an interesting signal and it gives us an idea of the average size and complexity of the typical bundle. ## Tests Acceptance test.
1 parent 4543547 commit ffe6723

File tree

11 files changed

+93
-2
lines changed

11 files changed

+93
-2
lines changed

acceptance/bundle/telemetry/deploy-config-file-count/a.yml

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bundle:
2+
name: boar
3+
4+
include:
5+
- a.yml
6+
- dir/*

acceptance/bundle/telemetry/deploy-config-file-count/dir/b.yml

Whitespace-only changes.

acceptance/bundle/telemetry/deploy-config-file-count/dir/c.yml

Whitespace-only changes.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
>>> [CLI] bundle deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/boar/default/files...
4+
Deploying resources...
5+
Deployment complete!
6+
7+
>>> cat out.requests.txt
8+
{
9+
"frontend_log_event_id": "[UUID]",
10+
"entry": {
11+
"databricks_cli_log": {
12+
"execution_context": {
13+
"cmd_exec_id": "[CMD-EXEC-ID]",
14+
"version": "[DEV_VERSION]",
15+
"command": "bundle_deploy",
16+
"operating_system": "[OS]",
17+
"execution_time_ms": SMALL_INT,
18+
"exit_code": 0
19+
},
20+
"bundle_deploy_event": {
21+
"bundle_uuid": "[UUID]",
22+
"resource_count": 0,
23+
"resource_job_count": 0,
24+
"resource_pipeline_count": 0,
25+
"resource_model_count": 0,
26+
"resource_experiment_count": 0,
27+
"resource_model_serving_endpoint_count": 0,
28+
"resource_registered_model_count": 0,
29+
"resource_quality_monitor_count": 0,
30+
"resource_schema_count": 0,
31+
"resource_volume_count": 0,
32+
"resource_cluster_count": 0,
33+
"resource_dashboard_count": 0,
34+
"resource_app_count": 0,
35+
"experimental": {
36+
"configuration_file_count": 4,
37+
"variable_count": 0,
38+
"complex_variable_count": 0,
39+
"lookup_variable_count": 0,
40+
"target_count": 0
41+
}
42+
}
43+
}
44+
}
45+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
trace $CLI bundle deploy
2+
3+
trace cat out.requests.txt | jq 'select(has("path") and .path == "/telemetry-ext") | .body.protoLogs.[] | fromjson'
4+
5+
# Disable pipefail. head will skip reading all input once it encounters a newline. Not disabling pipefail will trigger
6+
# a SIGPIPE in linux based systems.
7+
set +o pipefail
8+
cmd_exec_id=$(extract_command_exec_id.py)
9+
10+
update_file.py output.txt $cmd_exec_id '[CMD-EXEC-ID]'
11+
12+
rm out.requests.txt

acceptance/bundle/telemetry/deploy-no-uuid/output.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ Deployment complete!
3535
"resource_app_count": 0,
3636
"resource_job_ids": [
3737
"1"
38-
]
38+
],
39+
"experimental": {
40+
"configuration_file_count": 1,
41+
"variable_count": 0,
42+
"complex_variable_count": 0,
43+
"lookup_variable_count": 0,
44+
"target_count": 0
45+
}
3946
}
4047
}
4148
}

acceptance/bundle/telemetry/deploy/output.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ Deployment complete!
4141
"resource_pipeline_ids": [
4242
"[UUID]",
4343
"[UUID]"
44-
]
44+
],
45+
"experimental": {
46+
"configuration_file_count": 1,
47+
"variable_count": 0,
48+
"complex_variable_count": 0,
49+
"lookup_variable_count": 0,
50+
"target_count": 0
51+
}
4552
}
4653
}
4754
}

bundle/bundle.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ import (
3131

3232
const internalFolder = ".internal"
3333

34+
type Metrics struct {
35+
ConfigurationFileCount int64
36+
}
37+
3438
type Bundle struct {
3539
// BundleRootPath is the local path to the root directory of the bundle.
3640
// It is set when we instantiate a new bundle instance.
@@ -93,6 +97,8 @@ type Bundle struct {
9397
// Tagging is used to normalize tag keys and values.
9498
// The implementation depends on the cloud being targeted.
9599
Tagging tags.Cloud
100+
101+
Metrics Metrics
96102
}
97103

98104
func Load(ctx context.Context, path string) (*Bundle, error) {

bundle/config/loader/process_root_includes.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,9 @@ func (m *processRootIncludes) Apply(ctx context.Context, b *bundle.Bundle) diag.
9898
// Swap out the original includes list with the expanded globs.
9999
b.Config.Include = files
100100

101+
// Track number of bundle YAML (or JSON) files in the configuration. The +1 is there
102+
// to account for the root databricks.yaml file.
103+
b.Metrics.ConfigurationFileCount = int64(len(files)) + 1
104+
101105
return bundle.ApplySeq(ctx, b, out...)
102106
}

0 commit comments

Comments
 (0)