feat(gpu): add collectXidKernelLogs to collect Xid errors from the kernel ring buffer - #3340
Draft
matthewnewman43 wants to merge 1 commit into
Draft
feat(gpu): add collectXidKernelLogs to collect Xid errors from the kernel ring buffer#3340matthewnewman43 wants to merge 1 commit into
matthewnewman43 wants to merge 1 commit into
Conversation
|
🎯 Code Coverage (details) 🔗 Commit SHA: 39cf0b5 | Docs | Datadog PR Page | Give us feedback! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Adds
features.gpu.collectXidKernelLogs(defaultfalse). When enabled alongsidefeatures.logCollection.enabled, the node Agent tails the kernel ring buffer via a journald integration config and tags the messagessource:kernel/service:kernel.Motivation
NVIDIA reports GPU faults as Xid errors, and the driver emits them to the kernel ring buffer — not to any container's stdout. The out-of-the-box Xid log monitor and the GPU monitoring views both query
source:kernel.Today there is no supported way to get those messages through the operator: the GPU feature configures metrics and system-probe only, and nothing in the operator collects kernel logs. Users have to hand-roll an
extraConfdjournald config and hand-mount the host journal, and if they get the tagging wrong the Xid monitor silently matches nothing.So GPU monitoring can be fully enabled and Xid alerting still be dead, with no signal that anything is missing. This closes that gap with a supported toggle.
What it does
When
features.gpu.collectXidKernelLogs: trueandfeatures.logCollection.enabled: true:config_id: kernel,include_matches: [_TRANSPORT=kernel],source: kernel,service: kernel), mounted atconf.d/journald.d/var/log/journal) and/etc/machine-idread-only into the core AgentDesign notes
Opt-in, not implied by
gpu.enabled. Kernel log collection is billable log ingestion, and volume rises exactly when a node starts throwing Xids — the worst moment for a bill surprise.logcollectionis currently the only feature that setsDD_LOGS_ENABLED, and I did not want a metrics toggle to start log ingestion as a side effect. So this is explicitly opt-in and defaults off.No-op rather than error when log collection is off. The journald config is inert without the logs Agent, so enabling this alone does nothing. Open to a status condition or a validation error instead if maintainers prefer a louder failure — flagging it as a deliberate choice, not an oversight.
Collects the whole kernel transport, not only Xid lines. The name is about intent. Filtering to
Xidalone would be cheaper, but Xid triage leans on surrounding kernel context (bus-off, ECC, thermal, PCIe AER), and the GPU views query kernel logs beyond Xid lines. Filtering would break those and make the data much less useful for root-cause work.config_id: kernelis a compatibility contract, not an arbitrary name. The Agent's journald launcher keys tailers onjournald:<config_id>and skips a config whose identifier is already tailed (launcher.go,Identifier()inpkg/logs/tailers/journald/tailer.go). Consequences worth knowing:config_idthat also matches_TRANSPORT=kernelresults in the same messages being tailed twice.include_unitsalready sweeps in kernel messages, so pairing this with one needsexclude_matches: [_TRANSPORT=kernel]on the catch-all to avoid duplication./var/log/kern.logas a file gets duplicates with no warning — different launcher.There is a companion Helm-chart change that adds the same
config_id: kernelconfig with the matching catch-all exclusion: DataDog/k8s-datadog-agent-ops#9347 (internal). If both land, the chart's entry should be dropped in favor of this one rather than relying on launcher dedup to arbitrate — which config wins there is arrival-order dependent./var/log/journalis mounted withoutDirectoryOrCreate. On a node with a volatile-only journal, creating an empty directory would make the tailer silently collect nothing rather than fail visibly.Possible impact
None when the flag is unset — the field defaults to
false, and every code path is behind it. Consistent with the sibling GPU booleans (privilegedMode,patchCgroupPermissions), it is not explicitly defaulted, so no existing defaulting fixtures change.Requires Agent 7.39.0+ for
include_matches/exclude_matches, and a systemd journal on the node. Nodes that log to/var/log/kern.loginstead are not covered by this PR.Testing
config_id/ tagging contract.go build ./...,go test ./internal/controller/datadogagent/feature/gpu/...pass.make generate && make manifestsre-run for deepcopy and CRDs.Draft: I would like maintainer input on the opt-in-vs-default question and on the no-op-vs-error behavior before this is polished.