add debug logs

This commit is contained in:
Shreyas Goenka 2025-03-02 17:18:03 +01:00
parent 0e300c6a40
commit da7e9e23ca
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
3 changed files with 26 additions and 4 deletions

View File

@ -1 +1,10 @@
error: upload did not succeed after three attempts. err: &retries.Err{Err:(*apierr.APIError)(0x14000361540), Halt:true}. response body: (*telemetry.ResponseBody)(nil) attempt 0:
err: Endpoint not implemented.
response body: (*telemetry.ResponseBody)(nil)
attempt 1:
err: Endpoint not implemented.
response body: (*telemetry.ResponseBody)(nil)
attempt 2:
err: Endpoint not implemented.
response body: (*telemetry.ResponseBody)(nil)
error: upload did not succeed after three attempts

View File

@ -1 +1,10 @@
error: upload did not succeed after three attempts. err: <nil>. response body: &telemetry.ResponseBody{Errors:[]telemetry.LogError{}, NumProtoSuccess:1} attempt 0:
err: %!s(<nil>)
response body: &telemetry.ResponseBody{Errors:[]telemetry.LogError{}, NumProtoSuccess:1}
attempt 1:
err: %!s(<nil>)
response body: &telemetry.ResponseBody{Errors:[]telemetry.LogError{}, NumProtoSuccess:1}
attempt 2:
err: %!s(<nil>)
response body: &telemetry.ResponseBody{Errors:[]telemetry.LogError{}, NumProtoSuccess:1}
error: upload did not succeed after three attempts

View File

@ -79,7 +79,7 @@ func Upload(ctx context.Context) (*ResponseBody, error) {
var resp *ResponseBody var resp *ResponseBody
// Only try uploading logs for a maximum of 3 times. // Only try uploading logs for a maximum of 3 times.
for range 3 { for i := range 3 {
// TODO: Confirm that the timeout of a request here is indeed one minute. // TODO: Confirm that the timeout of a request here is indeed one minute.
resp, err = attempt(ctx, apiClient, logs) resp, err = attempt(ctx, apiClient, logs)
@ -88,6 +88,10 @@ func Upload(ctx context.Context) (*ResponseBody, error) {
return resp, nil return resp, nil
} }
fmt.Fprintf(os.Stderr, "attempt %d:\n", i)
fmt.Fprintf(os.Stderr, "err: %s\n", err)
fmt.Fprintf(os.Stderr, "response body: %#v\n", resp)
// Partial success. Retry. // Partial success. Retry.
if err == nil && resp.NumProtoSuccess < int64(len(logs)) { if err == nil && resp.NumProtoSuccess < int64(len(logs)) {
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
@ -104,7 +108,7 @@ func Upload(ctx context.Context) (*ResponseBody, error) {
} }
} }
return resp, fmt.Errorf("upload did not succeed after three attempts. err: %#v. response body: %#v", err, resp) return resp, errors.New("upload did not succeed after three attempts")
} }
func attempt(ctx context.Context, apiClient *client.DatabricksClient, protoLogs []string) (*ResponseBody, error) { func attempt(ctx context.Context, apiClient *client.DatabricksClient, protoLogs []string) (*ResponseBody, error) {