Skip to content

Commit fb87824

Browse files
committed
cli(debug.zip): update Datadog link for table dumps
This patch updates the Datadog dashboard and log explorer links which are generated as part of debug.zip Datadog upload. The table dump dashboard link contains filtering based on upload_id along with default timeframe of 1 month. Epic: None Part of: CRDB-51113 Release note: None
1 parent 0d80729 commit fb87824

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

pkg/cli/testdata/upload/tables

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ Logs API Hook: https://http-intake.logs.us5.datadoghq.com/api/v2/logs
3434
Logs API Hook: https://http-intake.logs.us5.datadoghq.com/api/v2/logs
3535
Logs API Hook: https://http-intake.logs.us5.datadoghq.com/api/v2/logs
3636
Upload ID: abc-20241114000000
37-
View as logs here: https://us5.datadoghq.com/logs?query=source:debug-zip&upload_id:abc-20241114000000
38-
View as tables here: https://us5.datadoghq.com/dashboard/ipq-44t-ez8/table-dumps-from-debug-zip?tpl_var_upload_id%5B0%5D=abc-20241114000000
37+
View as logs here: https://us5.datadoghq.com/logs?query=source:debug-zip upload_id:abc-20241114000000&from_ts=1728950400000&to_ts=1731542400000
38+
View as tables here:https://us5.datadoghq.com/dashboard/jrz-h9w-5em/table-dumps-from-debug-zip?tpl_var_upload_id=abc-20241114000000&from_ts=1728950400000&to_ts=1731542400000
3939
debug zip upload debugDir --dd-api-key=dd-api-key --dd-app-key=dd-app-key --cluster=ABC --include=tables

pkg/cli/zip_upload.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,15 @@ func uploadZipTables(ctx context.Context, uploadID string, debugDirPath string)
752752
uploadWG.Wait()
753753
close(uploadChan)
754754

755-
fmt.Printf("\nView as tables here: https://us5.datadoghq.com/dashboard/ipq-44t-ez8/table-dumps-from-debug-zip?tpl_var_upload_id%%5B0%%5D=%s\n", uploadID)
756-
fmt.Printf("View as logs here: https://us5.datadoghq.com/logs?query=source:debug-zip&upload_id:%s\n", uploadID)
755+
toUnixTimestamp := getCurrentTime().UnixMilli()
756+
//create timestamp for T-30 days.
757+
fromUnixTimestamp := toUnixTimestamp - (30 * 24 * 60 * 60 * 1000)
758+
759+
fmt.Printf("\nView as tables here:"+
760+
"https://us5.datadoghq.com/dashboard/jrz-h9w-5em/table-dumps-from-debug-zip?tpl_var_upload_id=%s&from_ts=%d&to_ts=%d\n",
761+
uploadID, fromUnixTimestamp, toUnixTimestamp)
762+
fmt.Printf("View as logs here: https://us5.datadoghq.com/logs?query=source:debug-zip upload_id:%s&from_ts=%d&to_ts=%d\n",
763+
uploadID, fromUnixTimestamp, toUnixTimestamp)
757764
return nil
758765
}
759766

pkg/cli/zip_upload_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ func TestUploadZipEndToEnd(t *testing.T) {
212212
includeFlag = "--include=misc"
213213
}
214214

215+
defer testutils.TestingHook(&getCurrentTime, func() time.Time {
216+
return time.Date(2024, 11, 14, 0, 0, 0, 0, time.UTC)
217+
})()
218+
215219
debugDir, cleanup := setupZipDir(t, testInput)
216220
defer cleanup()
217221

0 commit comments

Comments
 (0)