Skip to content

Commit 809cbba

Browse files
denikIsaac
andcommitted
Shorten cmd-exec-id to 64 bits in the same base62 format as the lineage hash
The id is 11 base62 characters instead of a UUID, in both the user agent (cmd-exec-id/) and telemetry (cmd_exec_id). Adds shortid.New. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent a81a087 commit 809cbba

65 files changed

Lines changed: 212 additions & 204 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎acceptance/auth/credentials/basic/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"Basic [ENCODED_AUTH]"
2020
],
2121
"User-Agent": [
22-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID] interactive/none auth/basic"
22+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none auth/basic"
2323
]
2424
},
2525
"method": "GET",

‎acceptance/auth/credentials/oauth/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"Bearer oauth-token"
4242
],
4343
"User-Agent": [
44-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID] interactive/none auth/oauth-m2m"
44+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none auth/oauth-m2m"
4545
]
4646
},
4747
"method": "GET",

‎acceptance/auth/credentials/pat/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"Bearer dapi1234"
2020
],
2121
"User-Agent": [
22-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID] interactive/none auth/pat"
22+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none auth/pat"
2323
]
2424
},
2525
"method": "GET",

‎acceptance/bin/extract_command_exec_id.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
#!/usr/bin/env python3
2+
"""
3+
Update ACC_REPLS to replace the cmd-exec-id from the first recorded request that has one in its
4+
User-Agent with [CMD_EXEC_ID_HASH]. The telemetry cmd_exec_id field is then only
5+
replaced if it matches the id the CLI actually sent.
6+
7+
Requires IncludeRequestHeaders = ["User-Agent"].
8+
"""
9+
210
import json
311
import os
412
import re
13+
import sys
514
from pathlib import Path
615

16+
sys.path.insert(0, str(Path(__file__).parent))
17+
from add_repl import add_repl
18+
719

820
def extract_cmd_exec_id():
921
requests_file = Path(os.environ["OUT_REQUESTS"])
@@ -36,5 +48,4 @@ def extract_cmd_exec_id():
3648

3749

3850
if __name__ == "__main__":
39-
exec_id = extract_cmd_exec_id()
40-
print(exec_id)
51+
add_repl(extract_cmd_exec_id(), "CMD_EXEC_ID_HASH")

‎acceptance/bundle/migrate/auto/run-no-commit/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Run URL: [DATABRICKS_URL]/jobs/[TEST_JOB_ID]/runs/[RUN_ID]?o=[WORKSPACE_ID]
3737
{
3838
"headers": {
3939
"User-Agent": [
40-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_run cmd-exec-id/[UUID] interactive/none lineage/AlC62qhncMO engine/direct auth/pat"
40+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_run cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none lineage/AlC62qhncMO engine/direct auth/pat"
4141
]
4242
},
4343
"method": "POST",

‎acceptance/bundle/migrate/command/added-direct-only/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Resources: 1 created, 0 changed, 0 deleted, 1 unchanged
3333
{
3434
"headers": {
3535
"User-Agent": [
36-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none engine/direct lineage/EnVBsDvOxKV auth/pat"
36+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/EnVBsDvOxKV auth/pat"
3737
]
3838
},
3939
"method": "POST",

‎acceptance/bundle/migrate/command/added/output.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Resources: 1 created, 0 changed, 0 deleted, 1 unchanged
2626
{
2727
"headers": {
2828
"User-Agent": [
29-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none engine/direct lineage/CEQDk4eRCyq auth/pat"
29+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/CEQDk4eRCyq auth/pat"
3030
]
3131
},
3232
"method": "POST",

‎acceptance/bundle/migrate/command/basic/output.txt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Plan: 0 to add, 0 to change, 0 to delete, 3 unchanged
3636
{
3737
"headers": {
3838
"User-Agent": [
39-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none engine/direct lineage/5MDu0ewFJPg auth/pat"
39+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/5MDu0ewFJPg auth/pat"
4040
]
4141
},
4242
"method": "GET",
@@ -48,7 +48,7 @@ Plan: 0 to add, 0 to change, 0 to delete, 3 unchanged
4848
{
4949
"headers": {
5050
"User-Agent": [
51-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none engine/direct lineage/5MDu0ewFJPg auth/pat"
51+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/5MDu0ewFJPg auth/pat"
5252
]
5353
},
5454
"method": "GET",
@@ -64,8 +64,8 @@ Files: 3 uploaded, 0 deleted
6464
Resources: 0 created, 0 changed, 0 deleted, 3 unchanged
6565

6666
>>> print_requests.py --get //jobs/get
67-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none engine/direct lineage/5MDu0ewFJPg auth/pat"
68-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none engine/direct lineage/5MDu0ewFJPg auth/pat"
67+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/5MDu0ewFJPg auth/pat"
68+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/5MDu0ewFJPg auth/pat"
6969

7070
=== Should show that it's already migrated
7171
>>> musterr [CLI] bundle deployment migrate

‎acceptance/bundle/migrate/command/permissions/output.txt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Plan: 0 to add, 0 to change, 0 to delete, 4 unchanged
2121
{
2222
"headers": {
2323
"User-Agent": [
24-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none engine/direct lineage/DIsgyJN5V5G auth/pat"
24+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/DIsgyJN5V5G auth/pat"
2525
]
2626
},
2727
"method": "GET",
@@ -33,7 +33,7 @@ Plan: 0 to add, 0 to change, 0 to delete, 4 unchanged
3333
{
3434
"headers": {
3535
"User-Agent": [
36-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[UUID] interactive/none engine/direct lineage/DIsgyJN5V5G auth/pat"
36+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_plan cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/DIsgyJN5V5G auth/pat"
3737
]
3838
},
3939
"method": "GET",
@@ -49,8 +49,8 @@ Files: 3 uploaded, 0 deleted
4949
Resources: 0 created, 0 changed, 0 deleted, 4 unchanged
5050

5151
>>> print_requests.py --get //jobs/get
52-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none engine/direct lineage/DIsgyJN5V5G auth/pat"
53-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none engine/direct lineage/DIsgyJN5V5G auth/pat"
52+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/DIsgyJN5V5G auth/pat"
53+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/DIsgyJN5V5G auth/pat"
5454

5555
=== Should show that it's already migrated
5656
>>> musterr [CLI] bundle deployment migrate

‎acceptance/bundle/migrate/command/removed-all/output.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Resources: 0 created, 0 changed, 2 deleted, 0 unchanged
2828
{
2929
"headers": {
3030
"User-Agent": [
31-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none engine/direct lineage/InPa9XqlYQg auth/pat"
31+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/InPa9XqlYQg auth/pat"
3232
]
3333
},
3434
"method": "POST",
@@ -40,7 +40,7 @@ Resources: 0 created, 0 changed, 2 deleted, 0 unchanged
4040
{
4141
"headers": {
4242
"User-Agent": [
43-
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[UUID] interactive/none engine/direct lineage/InPa9XqlYQg auth/pat"
43+
"cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_deploy cmd-exec-id/[CMD_EXEC_ID_HASH] interactive/none engine/direct lineage/InPa9XqlYQg auth/pat"
4444
]
4545
},
4646
"method": "POST",

0 commit comments

Comments
 (0)