-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EBPF-616] gpu: Use event consumer for processs monitoring #30755
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4b6d970
Add event consumer to GPU monitoring
gjulianm 239a6a1
Use correct consumer in tests
gjulianm d8edbc5
Fix comment
gjulianm 0207896
Use correct import
gjulianm 5eda681
Fix linter
gjulianm a24aa62
Fix linter
gjulianm 6f69fd5
Fix rebase
gjulianm bdbdddd
Fix windows build
gjulianm e3569e2
Split linux-only config code
gjulianm 7bb60ac
Enable eventmonitor even if only GPU is enabled
gjulianm f6a1357
Merge branch 'main' into guillermo.julian/gpu-event-consumer
gjulianm 238d74f
Merge branch 'main' into guillermo.julian/gpu-event-consumer
gjulianm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2024-present Datadog, Inc. | ||
|
||
//go:build linux | ||
|
||
package config | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/DataDog/datadog-agent/pkg/util/kernel" | ||
) | ||
|
||
// MinimumKernelVersion indicates the minimum kernel version required for GPU monitoring | ||
var MinimumKernelVersion kernel.Version | ||
|
||
func init() { | ||
// we rely on ring buffer support for GPU monitoring, hence the minimal kernel version is 5.8.0 | ||
MinimumKernelVersion = kernel.VersionCode(5, 8, 0) | ||
} | ||
|
||
// CheckGPUSupported checks if the host's kernel supports GPU monitoring | ||
func CheckGPUSupported() error { | ||
kversion, err := kernel.HostVersion() | ||
if err != nil { | ||
return fmt.Errorf("%w: could not determine the current kernel version: %w", ErrNotSupported, err) | ||
} | ||
|
||
if kversion < MinimumKernelVersion { | ||
return fmt.Errorf("%w: a Linux kernel version of %s or higher is required; we detected %s", ErrNotSupported, MinimumKernelVersion, kversion) | ||
} | ||
|
||
return nil | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2024-present Datadog, Inc. | ||
|
||
//go:build !linux | ||
|
||
package config | ||
|
||
import "errors" | ||
|
||
// CheckGPUSupported checks if the host's kernel supports GPU monitoring | ||
func CheckGPUSupported() error { | ||
return errors.New("GPU monitoring is not supported on this platform") | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm not 100% sure, and I still have a TODO list item to refactor this, but don't you need to call
evm.RegisterEventConsumer(
here, like other consumers ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's included in the
createGPUProcessEventConsumer
function, more specifically here in the generic method for process-data consumers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if you could let me know how do you end up refactoring that part it'd be great, as we were thinking about refactoring the system-probe modules to allow passing dependencies such as the event consumer without resorting to globals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the process consumer also calling it in
datadog-agent/cmd/system-probe/modules/eventmonitor.go
Line 81 in f6a1357
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the goal of the refactoring would be to just clean up the need to call register twice with subtly different names..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a different consumer, for forwarding data to process-agent I think. This one is the one I introduced in this PR to have a generic consumer that can be used to replace
pkg/process/monitor:ProcessMonitor
, which turned out to be only for USM use.