some cleanup

This commit is contained in:
Shreyas Goenka 2025-03-05 16:27:26 +01:00
parent d80a5ec673
commit 9774046825
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
4 changed files with 7 additions and 16 deletions

View File

@ -10,8 +10,8 @@
"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]\"},\"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]\"},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
"{\"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\":1},\"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\":1},\"cli_test_event\":{\"name\":\"VALUE2\"}}}}"
]
}
}

View File

@ -6,8 +6,8 @@ HH:MM:SS Debug: POST /telemetry-ext
> {
> "items": null,
> "protoLogs": [
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (210 more bytes)",
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (210 more bytes)"
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)",
> "{\"frontend_log_event_id\":\"[UUID]\",\"entry\":{\"databricks_cli_log\":{\"... (232 more bytes)"
> ],
> "uploadTime": "UNIX_TIME_MILLIS"
> }

View File

@ -7,12 +7,3 @@ Response.Body = '''
}
'''
DelaySeconds = 5
[[Repls]]
Old = "(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"
New = "HH:MM:SS"
[[Repls]]
Old = "pid=[0-9]+"
New = "pid=PID"

View File

@ -78,8 +78,8 @@ func Upload(ctx context.Context, cfg *config.Config) error {
return fmt.Errorf("failed to create API client: %w", err)
}
ctx, _ = context.WithTimeout(ctx, 3*time.Second)
var resp *ResponseBody
ctx, cancel := context.WithTimeout(ctx, 3*time.Second)
defer cancel()
// Only try uploading logs for a maximum of 3 times.
for i := range 3 {
@ -90,7 +90,7 @@ func Upload(ctx context.Context, cfg *config.Config) error {
// proceed
}
resp, err = attempt(ctx, apiClient, protoLogs)
resp, err := attempt(ctx, apiClient, protoLogs)
// All logs were uploaded successfully.
if err == nil && resp.NumProtoSuccess >= int64(len(protoLogs)) {