Skip to content

Add coarse git repo size to bundle deploy telemetry - #8248

Merged
andersrexdb merged 4 commits into
mainfrom
anders-rex/git-repo-size-telemetry
Dec 3, 2026
Merged

andersrexdb merged 4 commits into
mainfrom
anders-rex/git-repo-size-telemetry

Conversation

@andersrexdb

@andersrexdb andersrexdb commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Adds git_repo_size to bundle deploy telemetry for bundles in a local git checkout: a coarse bucket for the tracked file count (from the .git/index header) and for the size of .git/objects (packs plus loose objects). Only buckets are sent. Values that would be inaccurate (split or sparse index, shallow or partial clones, alternates) are left unset.

Tests

Unit tests for the reader and bucket boundaries, and the bundle/telemetry/deploy-git acceptance test.

This pull request and its description were written by Isaac.

Sends git_repo_size on the bundle deploy event for bundles in a local git
checkout: the tracked file count from the .git/index header and the size of
.git/objects/pack, each as a coarse bucket.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Anders Rex <anders.rex@databricks.com>
@github-actions github-actions Bot added the DABs DABs related issues label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 3210b35de | Workflow run

Selected 1 changed tests (limit=20, 0 not selected)

1 tests: regression=1 unreleased=0 coverage=0 failing=0
test branch main (5925432) latest (v1.29.0)
TestAccept/bundle/telemetry/deploy-git/DMS= ✅ ❌ ❌
TestAccept/bundle/telemetry/deploy-git/DMS=: branch ✅ | main (5925432) ❌ | latest (v1.29.0) ❌

main (5925432):

acceptance_test.go:1442: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1442
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1183
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:733
        	Error:      	Not equal: 
        	            	expected: "\n>>> [CLI] bundle deploy\nUploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...\nFiles: 1 uploaded, 0 deleted\nResources: 0 created, 0 changed, 0 deleted, 0 unchanged\n\n>>> cat [OUTPUT_DIR]/out.requests.txt\n{\n  \"git\": {\n    \"origin_url\": \"https://github.com/databricks/cli\",\n    \"branch\": \"main\",\n    \"commit\": \"[COMMIT_SHA]\"\n  },\n  \"from_workspace_folder\": null,\n  \"in_git_repo\": true,\n  \"git_repo_size\": {\n    \"tracked_file_count\": \"FILES_UNDER_1K\",\n    \"pack_size\": \"PACK_UNDER_10_MB\"\n  }\n}\n\n=== 1,202 tracked files and 12 MB of loose objects\n\n>>> git_repo_size\n{\n  \"tracked_file_count\": \"FILES_1K_TO_5K\",\n  \"pack_size\": \"PACK_10_MB_TO_100_MB\"\n}\n\n=== The same repository after git gc packs the objects\n\n>>> git_repo_size\n{\n  \"tracked_file_count\": \"FILES_1K_TO_5K\",\n  \"pack_size\": \"PACK_10_MB_TO_100_MB\"\n}\n"
        	            	actual  : "\n>>> [CLI] bundle deploy\nUploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...\nFiles: 1 uploaded, 0 deleted\nResources: 0 created, 0 changed, 0 deleted, 0 unchanged\n\n>>> cat [OUTPUT_DIR]/out.requests.txt\n{\n  \"git\": {\n    \"origin_url\": \"https://github.com/databricks/cli\",\n    \"branch\": \"main\",\n    \"commit\": \"[COMMIT_SHA]\"\n  },\n  \"from_workspace_folder\": null,\n  \"in_git_repo\": true,\n  \"git_repo_size\": null\n}\n\n=== 1,202 tracked files and 12 MB of loose objects\n\n>>> git_repo_size\nnull\n\n=== The same repository after git gc packs the objects\n\n>>> git_repo_size\nnull\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -15,6 +15,3 @@
        	            	   "in_git_repo": true,
        	            	-  "git_repo_size": {
        	            	-    "tracked_file_count": "FILES_UNDER_1K",
        	            	-    "pack_size": "PACK_UNDER_10_MB"
        	            	-  }
        	            	+  "git_repo_size": null
        	            	 }
        	            	@@ -24,6 +21,3 @@
        	            	 >>> git_repo_size
        	            	-{
        	            	-  "tracked_file_count": "FILES_1K_TO_5K",
        	            	-  "pack_size": "PACK_10_MB_TO_100_MB"
        	            	-}
        	            	+null
        	            	 
        	            	@@ -32,6 +26,3 @@
        	            	 >>> git_repo_size
        	            	-{
        	            	-  "tracked_file_count": "FILES_1K_TO_5K",
        	            	-  "pack_size": "PACK_10_MB_TO_100_MB"
        	            	-}
        	            	+null
        	            	 
        	Test:       	TestAccept/bundle/telemetry/deploy-git/DMS=
        	Messages:   	bundle/telemetry/deploy-git/output.txt vs /tmp/TestAcceptbundletelemetrydeploy-gitDMS=1145968357/002/output.txt
    acceptance_test.go:1220: 
        LOG.deploy-loose: Uploading bundle files to /Workspace/Users/tester@databricks.com/.bundle/test-bundle/default/files...
        LOG.deploy-loose: Files: 1 uploaded, 0 deleted
        LOG.deploy-loose: Resources: 0 created, 0 changed, 0 deleted, 0 unchanged
    acceptance_test.go:1220: 
        LOG.deploy-packed: Uploading bundle files to /Workspace/Users/tester@databricks.com/.bundle/test-bundle/default/files...
        LOG.deploy-packed: Files: 3 uploaded, 0 deleted
        LOG.deploy-packed: Resources: 0 created, 0 changed, 0 deleted, 0 unchanged
    acceptance_test.go:1220: LOG.gc: 
FAIL

latest (v1.29.0): same output as main (5925432)

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 3210b35

Run: 47070529787

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 61 7 1:31
✅​ aws-windows-latest-4core-16gb 61 7 3:12
✅​ azure linux-2core-8gb 61 7 1:51
✅​ azure-windows-latest-4core-16gb 61 7 3:19
✅​ gcp linux-2core-8gb 61 7 1:44
✅​ gcp-windows-latest-4core-16gb 61 7 3:13
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:18 azure-windows-latest-4core-16gb TestAccept
3:12 gcp-windows-latest-4core-16gb TestAccept
3:11 aws-windows-latest-4core-16gb TestAccept

Counts loose objects in the object store size, and leaves it unset for
repositories that use alternates. Treats a shared index as active only
when it is as new as the index, reads index.sparse from the global config
and requires core.sparseCheckout for a sparse index. Adds tests for the
cases where git_repo_size is not sent.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Anders Rex <anders.rex@databricks.com>
Comment thread libs/git/size.go Resolved
Comment thread libs/git/size.go Resolved
Comment thread libs/git/size.go Resolved
Counts only the files the repository layout defines (pack-* files and hex
named loose objects) instead of skipping a tmp_ prefix. Gives the read a
200 ms budget so a slow filesystem cannot hold up the deploy. Extends the
deploy-git acceptance test with a repository of known size, as loose
objects and after git gc.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Anders Rex <anders.rex@databricks.com>
@andersrexdb
andersrexdb marked this pull request as ready for review December 3, 2026 08:05
@andersrexdb
andersrexdb requested review from a team as code owners December 3, 2026 08:05
Co-authored-by: Isaac <no-reply@databricks.com>
@andersrexdb
andersrexdb added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit a35d709 Dec 3, 2026
25 checks passed
@andersrexdb
andersrexdb deleted the anders-rex/git-repo-size-telemetry branch December 3, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants