roachtest: upload runner-level logs to Datadog#166175
roachtest: upload runner-level logs to Datadog#166175williamchoe3 wants to merge 3 commits intocockroachdb:masterfrom
Conversation
|
Merging to
|
|
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Epic: None Release note: None Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
Epic: None Release note: None Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
79337eb to
f34b01f
Compare
|
The first 2 commits are from #166059, which this PR depends on. Once that PR merges, this branch will be rebased onto master and the diff will only show the third commit. |
|
PR #166175 Review: roachtest: upload runner-level logs to DatadogReviewing commit 3 only ( OverviewExtends the datadog log upload system with a new "runner logs" category for BLOCKERSNone. MEDIUMM1. The two functions share ~30 lines of identical logic: Datadog context creation, API client setup, the file iteration loop (stat → copy metadata → select parser → parse/upload → log timing), and the summary log. The only differences are the discovery function called and the child logger name. This is manageable for two categories, but the package doc comment establishes categories as a first-class concept ("Current categories: Test logs, Runner logs"), suggesting more may follow. If a third category arrives, the duplication becomes a real maintenance burden. Consider extracting the shared upload loop into a helper: func uploadLogFiles(
ctx context.Context, l *logger.Logger, logsAPI *datadogV2.LogsApi,
files []string, baseDir string, cfg LogMetadata,
) error { ... }Not blocking since two copies is tolerable, but worth noting before a third appears. M2. Runner metadata produces empty-value tags in Datadog
func (m LogMetadata) makeTags() map[string]string {
tagMap := map[string]string{
testNameTagName: m.TestName, // ""
ownerTagName: m.Owner, // ""
cloudTagName: m.Cloud, // ""
platformTagName: m.Platform, // ""
...
}
}This produces Datadog tags like Options:
NITSN1. Typo in // ... and it's parser does not match any lines ...Should be "its parser" (possessive, not contraction). N2. "uploaded X log events" printed even after upload error if uploadErr != nil {
l.Printf("error uploading %s to Datadog (%d entries uploaded): %v", ...)
}
l.Printf("uploaded %d log events from %s in %s", ...)After a failed upload, the log shows both an error and a success-like message ("uploaded 0 log events"). Same pattern exists in if uploadErr != nil {
l.Printf("error uploading %s ...", ...)
} else {
l.Printf("uploaded %d log events from %s in %s", ...)
}N3. if strings.HasSuffix(name, ".log") && name[0] == 'w' && name[1] >= '0' && name[1] <= '9' {This matches any file starting with // Match w<digits>.log exactly.
if strings.HasSuffix(name, ".log") && len(name) > 4 {
stem := strings.TrimSuffix(name, ".log")
if stem[0] == 'w' {
if _, err := strconv.Atoi(stem[1:]); err == nil {
return true
}
}
}Not worth the complexity unless false matches become a problem. N4. Blank line removed in The diff removes a blank line after the function signature opening brace in |
Added a comment on the top of file to explain the boilerplate, I agree if this needs to be extended for a 3rd category of logs for roachtest, I would look to implementing an interface that clearly defines what is needed by a M2, N1: addressed |
1d65ecd to
61aa4cd
Compare
Add support for uploading test runner logs (test_runner-*.log, w*.log) to Datadog. Epic: None Release note: None Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
61aa4cd to
b9ddc82
Compare

Extends roachtest's datadog integration by adding support for uploading test runner level logs (
test_runner-*.log,w*.log) to Datadog. Previously, these were ignored.