-
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
[system-probe] Start of dynamic instrumentation system probe module #16034
Conversation
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.
Few nits. I'll preemptively approve since they're easy fixes.
.github/CODEOWNERS
Outdated
@@ -247,6 +247,7 @@ | |||
/pkg/config/remote/service/meta/ @DataDog/remote-config @DataDog/software-integrity-and-trust | |||
/pkg/diagnose/ @Datadog/container-integrations | |||
/pkg/diagnose/connectivity/ @DataDog/agent-shared-components | |||
/pkg/dynamicinstrumentation/ @DataDog/debugger |
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.
Offset in column 2
pkg/dynamicinstrumentation/module.go
Outdated
|
||
type Module struct{} | ||
|
||
func NewModule(config *Config) (*Module, error) { |
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.
Linter errors are right - you have an exclusion flag in the other file but no build flag here so for non-Linux platforms both files will be built, causing name collision. I would probably suggest that you maybe name this file module_linux
just to make it clear from that standpoint that this only works on that platform.
import ( | ||
"github.com/DataDog/datadog-agent/cmd/system-probe/api/module" | ||
"github.com/DataDog/datadog-agent/pkg/ebpf" | ||
"github.com/DataDog/datadog-agent/pkg/security/config" |
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.
Linter is correct here - you're not using "github.com/DataDog/datadog-agent/pkg/security/config"
package in windows impl
@@ -131,6 +133,9 @@ func InitSystemProbeConfig(cfg Config) { | |||
cfg.BindEnvAndSetDefault(join(spNS, "zypper_repos_dir"), suffixHostEtc(defaultZypperReposDirSuffix), "DD_ZYPPER_REPOS_DIR") | |||
cfg.BindEnvAndSetDefault(join(spNS, "attach_kprobes_with_kprobe_events_abi"), false, "DD_ATTACH_KPROBES_WITH_KPROBE_EVENTS_ABI") | |||
|
|||
// User Tracer | |||
cfg.BindEnvAndSetDefault(join(diNS, "enabled"), false, "DD_DYNAMIC_INSTRUMENTATION_ENABLED") |
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.
it is recommended to add the feature to:
- pkg/metadata/inventories/README.md
- pkg/metadata/inventories/inventories.go
and to add UTs for the configuration:
- pkg/network/config/config_test.go
adding an example PR from my team #14620
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 metadata/inventories package seems to have specific features rather than having the whole module enabled. For example USM just has different network protocols it supports, rather than USM as a whole. Are you sure it makes sense to have something like feature_dynamic_instrumentation_enabled
? I don't know what inventories is so I really don't know. I can certainly add it and then add specific features as they get added.
Similarly, dynamic instrumentation might not belong under pkg/network/config
since it's not a network feature.
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.
usm is not the best example (unforutnately, as we started as a feature in npm and evolved)
but take a look in npm https://github.com/DataDog/datadog-agent/blob/main/pkg/metadata/inventories/inventories.go#L418
or CWS https://github.com/DataDog/datadog-agent/blob/main/pkg/metadata/inventories/inventories.go#L415
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.
regarding the configuration test, you don't need to add them in pkg/network/config/config_test.go
but a similar to the correct config_test.go
file
another example in other package https://github.com/DataDog/datadog-agent/blob/main/pkg/config/config_test.go
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.
Sounds good - I've added to the metadata/inventories package and added a test to cmd/system-probe/config/config_linux_test.go
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.
Minor suggestions, but nothing blocking.
@brycekahle Is there anything else I can do to help this get merged? |
dc3668d
to
d8adf12
Compare
New dependencies added
We suggest you consider adding the If you have questions, we are happy to help, come visit us in the #serverless slack channel and provide a link to this comment. |
@grantseltzer seems like you never logged in into CircleCI, therefore the relevant jobs didn't run, and those jobs are required for merging |
d8adf12
to
838ec17
Compare
60d736f
to
e889753
Compare
Signed-off-by: grantseltzer <[email protected]>
Signed-off-by: grantseltzer <[email protected]>
Signed-off-by: grantseltzer <[email protected]>
Signed-off-by: grantseltzer <[email protected]>
…on other platforms Signed-off-by: grantseltzer <[email protected]>
Signed-off-by: grantseltzer <[email protected]>
…r now) Signed-off-by: grantseltzer <[email protected]>
Signed-off-by: grantseltzer <[email protected]>
Signed-off-by: grantseltzer <[email protected]>
e889753
to
fd236e4
Compare
What does this PR do?
This introduces the scaffolding for the new dynamic instrumentation system-probe module. This will be a module used by the dynamic-instrumentation product for system level tracing of user applications. This belongs in the system-probe as it will soon need higher level permissions (CAP_SYS_ADMIN, CAP_BPF) for loading and attaching bpf programs, and inspecting inside container filesystems.
Motivation
This PR simply creates the module in code, and gives it the scaffolding for reading a static configuration file. The motivation for this is to break up the large amount of code that will need to be placed here into smaller PRs.
Additional Notes
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
inv system-probe.build
sudo bin/system-probe/system-probe
You should see it's disabled:
You can run it enabled by setting
DD_DYNAMIC_INSTRUMENTATION_ENABLED=1
or adding the following section to your system-probe config:Reviewer's Checklist
Triage
milestone is set.major_change
label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.changelog/no-changelog
label has been applied.qa/skip-qa
label is not applied.team/..
label has been applied, indicating the team(s) that should QA this change.need-change/operator
andneed-change/helm
labels have been applied.k8s/<min-version>
label, indicating the lowest Kubernetes version compatible with this feature.