-
Notifications
You must be signed in to change notification settings - Fork 179
Add async logger for telemetry #2278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 131 commits
Commits
Show all changes
152 commits
Select commit
Hold shift + click to select a range
ab10720
squash all commits
shreyas-goenka 3964d8d
[WIP] In process telemetry logger
shreyas-goenka 01d63dd
Merge remote-tracking branch 'origin' into implement-async-logger
shreyas-goenka 155fe7b
-
shreyas-goenka acd64fa
merge
shreyas-goenka ee3568c
-'
shreyas-goenka 8f8463f
-
shreyas-goenka f092e21
add back worker input
shreyas-goenka 5d75c3f
Merge remote-tracking branch 'origin' into implement-async-logger
shreyas-goenka 427c755
major cleanup
shreyas-goenka b83e576
-
shreyas-goenka f09a780
fix panic
shreyas-goenka 90148d8
replace os
shreyas-goenka 259a21a
-
shreyas-goenka e4a1f42
-
shreyas-goenka d7bf1dc
add test for upload
shreyas-goenka 382efe4
-
shreyas-goenka c412eb7
-
shreyas-goenka da0cf95
-
shreyas-goenka 8801587
pass test
shreyas-goenka 5385faf
fix test
shreyas-goenka c1a3225
fx test
shreyas-goenka 4f97900
-
shreyas-goenka a8b366e
-
shreyas-goenka 5c2205a
-
shreyas-goenka dc0ab30
-
shreyas-goenka 2cd25e3
-
shreyas-goenka 2cbc39f
-
shreyas-goenka f3e7594
fx test
shreyas-goenka 403f612
address comments
shreyas-goenka 0423b09
add filtering for auth
shreyas-goenka 981dbf7
add bash script for waiting
shreyas-goenka 918af62
remove eventually files
shreyas-goenka 39ff290
pass test
shreyas-goenka 33ff865
cleaner output
shreyas-goenka 17698a5
-
shreyas-goenka 5b6ffd5
-
shreyas-goenka 963022a
-
shreyas-goenka 9e2a689
-
shreyas-goenka 0abba86
=
shreyas-goenka 407e9e0
-
shreyas-goenka 414a94d
-
shreyas-goenka d5e03f0
-
shreyas-goenka 8c90ad0
clean
shreyas-goenka 1bb4537
Merge remote-tracking branch 'origin' into async-logger-clean
shreyas-goenka c9ebc82
add error test case'
shreyas-goenka fd6b129
make test generic
shreyas-goenka 73fac82
remove pid file
shreyas-goenka 5e2e03a
fix test
shreyas-goenka 0253039
-
shreyas-goenka 369faff
return 501
shreyas-goenka e43a0a0
skip end to end integration tests
shreyas-goenka f88db77
-
shreyas-goenka a6e8e92
Merge remote-tracking branch 'origin' into async-logger-clean
shreyas-goenka 23b42e9
Merge remote-tracking branch 'origin' into async-logger-clean
shreyas-goenka 9d65761
pretty print
shreyas-goenka c8ac08c
consolidate test.toml
shreyas-goenka 58bf931
comment
shreyas-goenka 79fad7a
pass test
shreyas-goenka 4cdcbd6
Merge remote-tracking branch 'origin' into async-logger-clean
shreyas-goenka f98369d
-
shreyas-goenka d86ccf6
Add library for spawning a daemon
shreyas-goenka 6148681
implement
shreyas-goenka 533e7be
-
shreyas-goenka de6ebdb
Merge remote-tracking branch 'origin' into daemon-library
shreyas-goenka d15ff75
-
shreyas-goenka e970a12
-
shreyas-goenka 3c4443c
cleanup
shreyas-goenka 42c526f
-
shreyas-goenka ecbbee1
more test
shreyas-goenka 2c71269
-
shreyas-goenka a9ccc32
-'
shreyas-goenka 403c1b2
-
shreyas-goenka 07141ba
skip wait test on windows
shreyas-goenka a4009ed
use script to wait
shreyas-goenka b130787
-
shreyas-goenka 50308f2
-
shreyas-goenka f6a0223
extend timeout to 1 minute
shreyas-goenka 6f63e14
-
shreyas-goenka 11af4ba
delay closing output log file
shreyas-goenka 75f3008
-
shreyas-goenka e649fc0
-
shreyas-goenka f6bd82d
add readme
shreyas-goenka 8eb454d
-
shreyas-goenka 608f0ad
-
shreyas-goenka c59b11f
-
shreyas-goenka dfd26e3
-
shreyas-goenka f504343
-
shreyas-goenka 86428da
-
shreyas-goenka 12f1fbd
-
shreyas-goenka 8a0b359
Merge remote-tracking branch 'origin' into async-logger-clean
shreyas-goenka f48fbb9
merge daemon
shreyas-goenka 520f069
use daemon
shreyas-goenka a98993a
-
shreyas-goenka 3cfeb64
add skip functionality
shreyas-goenka 18748f7
rename
shreyas-goenka 96ade4e
merge
shreyas-goenka d7abb3b
remove daemon acceptance tests
shreyas-goenka 5ee52ac
remove parent child selftest commands
shreyas-goenka 5056070
remove user agent from telemetry tests
shreyas-goenka ae8ebaa
add acc test for oauth'
shreyas-goenka 68646a5
remove leaking logs
shreyas-goenka 69f5b03
remove log line
shreyas-goenka f11f589
toml files
shreyas-goenka 0d37654
add test for timeout
shreyas-goenka 8cfbb33
Merge remote-tracking branch 'origin' into async-logger-clean
shreyas-goenka a0e6f8f
pull latest
shreyas-goenka 5939616
rename env var
shreyas-goenka 9e3aa59
-
shreyas-goenka 00ebbb9
add integration test
shreyas-goenka 6acb6f1
consolidate repl
shreyas-goenka 63ad316
fx
shreyas-goenka 32a600a
cleanip
shreyas-goenka 3f48d1f
-
shreyas-goenka 549e49e
cancel test
shreyas-goenka 71643ab
-
shreyas-goenka 6dc73d7
-
shreyas-goenka 0f98570
Revert "-"
shreyas-goenka 33a7f71
-
shreyas-goenka a556d51
Merge remote-tracking branch 'origin' into async-logger-clean
shreyas-goenka a407a54
fix test toml
shreyas-goenka da0e08d
log to stdout / stderr
shreyas-goenka bddbc5d
-
shreyas-goenka 5da92e9
raise to warn
shreyas-goenka 8b3d942
-
shreyas-goenka c1272b3
use Getenv
shreyas-goenka fd271d3
add max retries
shreyas-goenka fec9c4e
move wait_pid to python
shreyas-goenka 362a93b
remove todo
shreyas-goenka c898aaf
-
shreyas-goenka eb2b187
lint
shreyas-goenka 476b8bb
address comments
shreyas-goenka e500bcb
remove the -f flag
shreyas-goenka 0ff0877
add more test cases for retry on status code
shreyas-goenka 7f71651
better retrying logic
shreyas-goenka db4fc69
rename environment variables
shreyas-goenka f249a1a
consolidate test configuration
shreyas-goenka 8213c4f
make wait script more robust
shreyas-goenka 0e300c6
lint
shreyas-goenka da7e9e2
add debug logs
shreyas-goenka 6492404
-
shreyas-goenka 5a2dcbb
incremental improvements
shreyas-goenka 30a582a
-
shreyas-goenka efdb977
better debug logs
shreyas-goenka fbc657d
Merge remote-tracking branch 'origin' into async-logger-clean
shreyas-goenka 217d4e7
add comment for failure
shreyas-goenka bd35ac9
implement the command in cobra
shreyas-goenka d854660
added debug log test
shreyas-goenka 116c513
remove envvars functino
shreyas-goenka 9e29462
use proper loggers
shreyas-goenka dab957d
-
shreyas-goenka 2664028
lint'
shreyas-goenka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env python3 | ||
| import sys | ||
| import os | ||
| import time | ||
| import platform | ||
| import subprocess | ||
|
|
||
|
|
||
| def wait_pid(pid): | ||
| max_attempts = 600 # 600 * 0.1 seconds = 1 minute | ||
| sleep_time = 0.1 | ||
|
|
||
| for i in range(max_attempts): | ||
| # Check if we are on Windows or a Unix system. | ||
| if platform.system().lower() == "windows": | ||
| # Windows approach: use tasklist to check for the existence of the process. | ||
| try: | ||
| # Get the output of 'tasklist' | ||
| output = subprocess.check_output(["tasklist"], text=True) | ||
| except subprocess.CalledProcessError: | ||
| print("[wait_pid] Error retrieving tasklist. Assuming process has ended.") | ||
| return 0 | ||
|
|
||
| # if the PID is not found in the list then assume the process ended. | ||
| if str(pid) not in output: | ||
|
shreyas-goenka marked this conversation as resolved.
Outdated
|
||
| print("[wait_pid] process has ended") | ||
| return 0 | ||
| else: | ||
| # Linux/macOS approach: using os.kill with signal 0 to check if the process exists. | ||
| try: | ||
| os.kill(pid, 0) | ||
| except OSError: | ||
| print("[wait_pid] process has ended") | ||
| return 0 | ||
|
|
||
| time.sleep(sleep_time) | ||
|
|
||
| print(f"Timeout: Process {pid} did not end within 1 minute") | ||
| return 1 | ||
|
|
||
|
|
||
| try: | ||
| pid = int(sys.argv[1]) | ||
| except ValueError: | ||
| print("Error: PID must be an integer.") | ||
| sys.exit(1) | ||
|
shreyas-goenka marked this conversation as resolved.
Outdated
|
||
|
|
||
| exit_code = wait_pid(pid) | ||
| sys.exit(exit_code) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| IncludeRequestHeaders = ["Authorization"] | ||
| Local = true | ||
| Cloud = false | ||
|
|
||
| [[Repls]] | ||
| Old = '17\d{11}' | ||
| New = '"UNIX_TIME_MILLIS"' | ||
|
|
||
| [[Repls]] | ||
| Old = 'darwin|linux|windows' | ||
| New = 'OS' | ||
|
shreyas-goenka marked this conversation as resolved.
Outdated
|
||
|
|
||
| [[Repls]] | ||
| Old = 'execution_time_ms\\\":\d{1,5},' | ||
| New = 'execution_time_ms\":\"SMALL_INT\",' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ] | ||
| }, | ||
| "method": "POST", | ||
| "path": "/telemetry-ext", | ||
| "body": { | ||
| "uploadTime": "UNIX_TIME_MILLIS", | ||
| "items": [], | ||
| "protoLogs": [ | ||
| "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"cli_test_event\":{\"name\":\"VALUE1\"}}}}", | ||
| "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"cli_test_event\":{\"name\":\"VALUE2\"}}}}" | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
|
|
||
| >>> [CLI] telemetry upload | ||
| Telemetry logs uploaded successfully | ||
| Response: | ||
| {"errors":[],"numProtoSuccess":2} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export DATABRICKS_CLI_TELEMETRY_UPLOAD_LOGS_FILE=./out.upload.txt | ||
|
|
||
| # This command / test cannot be run in inprocess / debug mode. This is because | ||
| # it does not go through the [root.Execute] function. | ||
| trace $CLI telemetry upload < stdin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "logs": [ | ||
| { | ||
| "frontend_log_event_id": "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA", | ||
| "entry": { | ||
| "databricks_cli_log": { | ||
| "cli_test_event": { | ||
| "name": "VALUE1" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "frontend_log_event_id": "BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB", | ||
| "entry": { | ||
| "databricks_cli_log": { | ||
| "cli_test_event": { | ||
| "name": "VALUE2" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| RecordRequests = true | ||
|
|
||
| [[Server]] | ||
| Pattern = "POST /telemetry-ext" | ||
| Response.Body = ''' | ||
| { | ||
| "errors": [], | ||
| "numProtoSuccess": 2 | ||
| } | ||
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ] | ||
| }, | ||
| "method": "POST", | ||
| "path": "/telemetry-ext", | ||
| "body": { | ||
| "uploadTime": "UNIX_TIME_MILLIS", | ||
| "items": [], | ||
| "protoLogs": [ | ||
| "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"OS\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}", | ||
| "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"OS\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}" | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| error: Failed to upload telemetry logs: Endpoint not implemented. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
|
|
||
| >>> [CLI] selftest send-telemetry | ||
| [wait_pid] process has ended |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export DATABRICKS_CLI_TELEMETRY_PID_FILE=./telemetry.pid | ||
| export DATABRICKS_CLI_TELEMETRY_UPLOAD_LOGS_FILE=./out.upload_process.txt | ||
|
shreyas-goenka marked this conversation as resolved.
Outdated
|
||
|
|
||
| # This test ensures that the main CLI command does not error even if | ||
| # telemetry upload fails. | ||
| trace $CLI selftest send-telemetry | ||
|
|
||
| # Wait for the child telemetry process to finish | ||
| wait_pid.py $(cat ./telemetry.pid) | ||
|
shreyas-goenka marked this conversation as resolved.
|
||
|
|
||
| # cleanup the pid file | ||
| rm -f ./telemetry.pid | ||
|
shreyas-goenka marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| RecordRequests = true | ||
|
|
||
| [[Server]] | ||
| Pattern = "POST /telemetry-ext" | ||
| Response.Body = ''' | ||
| { | ||
| "error_code": "ERROR_CODE", | ||
| "message": "Endpoint not implemented." | ||
| } | ||
| ''' | ||
| Response.StatusCode = 501 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
|
|
||
| >>> [CLI] selftest send-telemetry | ||
| telemetry process not started. No pid file found |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export DATABRICKS_CLI_TELEMETRY_PID_FILE=./telemetry.pid | ||
| export DATABRICKS_CLI_TELEMETRY_UPLOAD_LOGS_FILE=./out.upload_process.txt | ||
| export DATABRICKS_CLI_DISABLE_TELEMETRY="true" | ||
|
|
||
| trace $CLI selftest send-telemetry | ||
|
|
||
| if [ -f ./telemetry.pid ]; then | ||
| echo "telemetry process was started" | ||
| exit 1 | ||
| else | ||
| echo "telemetry process not started. No pid file found" | ||
|
shreyas-goenka marked this conversation as resolved.
|
||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| RecordRequests = true | ||
|
|
||
| [[Server]] | ||
| Pattern = "POST /telemetry-ext" | ||
| Response.Body = ''' | ||
| { | ||
| "errors": [], | ||
| "numProtoSuccess": 2 | ||
| } | ||
| ''' | ||
|
shreyas-goenka marked this conversation as resolved.
|
||
3 changes: 3 additions & 0 deletions
3
acceptance/telemetry/upload-succeeds-integration/out.upload_process.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Telemetry logs uploaded successfully | ||
| Response: | ||
| {"errors":[],"numProtoSuccess":2} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| >>> [CLI] selftest send-telemetry | ||
| waiting for telemetry process to finish | ||
| [wait_pid] process has ended |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export DATABRICKS_CLI_TELEMETRY_PID_FILE=./telemetry.pid | ||
| export DATABRICKS_CLI_TELEMETRY_UPLOAD_LOGS_FILE=./out.upload_process.txt | ||
|
|
||
| trace $CLI selftest send-telemetry | ||
|
|
||
| echo "waiting for telemetry process to finish" | ||
|
|
||
| # Wait for the child telemetry process to finish | ||
| wait_pid.py $(cat ./telemetry.pid) | ||
|
|
||
| # cleanup the pid file | ||
| rm -f ./telemetry.pid |
14 changes: 14 additions & 0 deletions
14
acceptance/telemetry/upload-succeeds-integration/test.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # RecordRequests is not supported for integration tests yet. Once we have support | ||
| # for running integration tests with record requests we can remove this test since | ||
| # it's a copy of acceptance/telemetry/upload-succeeds. | ||
| Local = true | ||
| Cloud = true | ||
|
|
||
| [[Server]] | ||
| Pattern = "POST /telemetry-ext" | ||
| Response.Body = ''' | ||
| { | ||
| "errors": [], | ||
| "numProtoSuccess": 2 | ||
| } | ||
| ''' |
45 changes: 45 additions & 0 deletions
45
acceptance/telemetry/upload-succeeds-oauth/out.requests.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "method": "GET", | ||
| "path": "/oidc/.well-known/oauth-authorization-server" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Basic [ENCODED_AUTH]" | ||
| ] | ||
| }, | ||
| "method": "POST", | ||
| "path": "/oidc/v1/token", | ||
| "raw_body": "grant_type=client_credentials\u0026scope=all-apis" | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/oidc/.well-known/oauth-authorization-server" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Basic [ENCODED_AUTH]" | ||
| ] | ||
| }, | ||
| "method": "POST", | ||
| "path": "/oidc/v1/token", | ||
| "raw_body": "grant_type=client_credentials\u0026scope=all-apis" | ||
| } | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer oauth-token" | ||
| ] | ||
| }, | ||
| "method": "POST", | ||
| "path": "/telemetry-ext", | ||
| "body": { | ||
| "uploadTime": "UNIX_TIME_MILLIS", | ||
| "items": [], | ||
| "protoLogs": [ | ||
| "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"OS\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}", | ||
| "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"OS\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}" | ||
| ] | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
acceptance/telemetry/upload-succeeds-oauth/out.upload_process.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Telemetry logs uploaded successfully | ||
| Response: | ||
| {"errors":[],"numProtoSuccess":2} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| >>> [CLI] selftest send-telemetry | ||
| waiting for telemetry process to finish | ||
| [wait_pid] process has ended |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| export DATABRICKS_CLI_TELEMETRY_PID_FILE=./telemetry.pid | ||
| export DATABRICKS_CLI_TELEMETRY_UPLOAD_LOGS_FILE=./out.upload_process.txt | ||
|
|
||
| # Unset the token which is configured by default | ||
| # in acceptance tests | ||
| export DATABRICKS_TOKEN="" | ||
|
|
||
| export DATABRICKS_CLIENT_ID=client_id | ||
| export DATABRICKS_CLIENT_SECRET=client_secret | ||
|
|
||
| trace $CLI selftest send-telemetry | ||
|
|
||
| echo "waiting for telemetry process to finish" | ||
|
|
||
| # Wait for the child telemetry process to finish | ||
| wait_pid.py $(cat ./telemetry.pid) | ||
|
|
||
| # cleanup the pid file | ||
| rm -f ./telemetry.pid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| RecordRequests = true | ||
|
|
||
| [[Server]] | ||
| Pattern = "POST /telemetry-ext" | ||
| Response.Body = ''' | ||
| { | ||
| "errors": [], | ||
| "numProtoSuccess": 2 | ||
| } | ||
| ''' | ||
|
|
||
|
|
||
| # "client_id:client_secret" in base64 is Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ=, expect to | ||
| # see this in Authorization header | ||
| [[Repls]] | ||
| Old = "Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ=" | ||
| New = "[ENCODED_AUTH]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "headers": { | ||
| "Authorization": [ | ||
| "Bearer [DATABRICKS_TOKEN]" | ||
| ] | ||
| }, | ||
| "method": "POST", | ||
| "path": "/telemetry-ext", | ||
| "body": { | ||
| "uploadTime": "UNIX_TIME_MILLIS", | ||
| "items": [], | ||
| "protoLogs": [ | ||
| "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"OS\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE1\"}}}}", | ||
| "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"execution_context\":{\"cmd_exec_id\":\"[UUID]\",\"version\":\"[DEV_VERSION]\",\"command\":\"selftest_send-telemetry\",\"operating_system\":\"OS\",\"execution_time_ms\":\"SMALL_INT\",\"exit_code\":0},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}" | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Telemetry logs uploaded successfully | ||
| Response: | ||
| {"errors":[],"numProtoSuccess":2} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| >>> [CLI] selftest send-telemetry | ||
| waiting for telemetry process to finish | ||
| [wait_pid] process has ended |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export DATABRICKS_CLI_TELEMETRY_PID_FILE=./telemetry.pid | ||
| export DATABRICKS_CLI_TELEMETRY_UPLOAD_LOGS_FILE=./out.upload_process.txt | ||
|
|
||
| trace $CLI selftest send-telemetry | ||
|
|
||
| echo "waiting for telemetry process to finish" | ||
|
|
||
| # Wait for the child telemetry process to finish | ||
| wait_pid.py $(cat ./telemetry.pid) | ||
|
|
||
| # cleanup the pid file | ||
| rm -f ./telemetry.pid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| RecordRequests = true | ||
|
|
||
| [[Server]] | ||
| Pattern = "POST /telemetry-ext" | ||
| Response.Body = ''' | ||
| { | ||
| "errors": [], | ||
| "numProtoSuccess": 2 | ||
| } | ||
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| error: Failed to flush telemetry log due to timeout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| >>> [CLI] selftest send-telemetry | ||
| waiting for telemetry process to finish | ||
| [wait_pid] process has ended |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.