-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add otelcollector.installation_method and set for DDOT bare-metal
#47919
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
Changes from 8 commits
2b3ddd0
9d55971
dd2b791
4c3f084
2ee3591
7342f65
05b2a6e
86de4ba
7227f63
f63a5b9
4761da1
d5d862b
44b4de6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| api_key: ggggg77777 | ||
| otelcollector: | ||
| converter: | ||
| features: [pprof, zpages, health_check, datadog] | ||
| features: [pprof, zpages, health_check, datadog] | ||
| installation_method: bare-metal |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ import ( | |
| "github.com/DataDog/datadog-agent/pkg/util/winutil" | ||
|
|
||
| "golang.org/x/sys/windows" | ||
| "golang.org/x/sys/windows/registry" | ||
| "golang.org/x/sys/windows/svc" | ||
| "golang.org/x/sys/windows/svc/mgr" | ||
| ) | ||
|
|
@@ -204,6 +205,9 @@ func ensureDDOTService() error { | |
| } | ||
| // Best-effort: align service DACL to allow the core Agent user to control OTEL service | ||
| configureDDOTServicePermissions(s) | ||
| if err := setDDOTServiceEnvVars(); err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
|
|
@@ -223,6 +227,9 @@ func ensureDDOTService() error { | |
| } | ||
| // Best-effort: align service DACL to allow the core Agent user to control OTEL service | ||
| configureDDOTServicePermissions(s) | ||
| if err := setDDOTServiceEnvVars(); err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
|
|
@@ -337,6 +344,20 @@ func configureDDOTServicePermissions(s *mgr.Service) { | |
| } | ||
| } | ||
|
|
||
| // setDDOTServiceEnvVars writes the DDOT service environment variables to the registry. | ||
| func setDDOTServiceEnvVars() error { | ||
| key, _, err := registry.CreateKey( | ||
| registry.LOCAL_MACHINE, | ||
| `SYSTEM\CurrentControlSet\Services\`+otelServiceName+`\Environment`, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Our Windows service helper writes a service's environment as an Useful? React with 👍 / 👎. |
||
| registry.SET_VALUE, | ||
| ) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to open service environment registry key: %w", err) | ||
| } | ||
| defer key.Close() | ||
| return key.SetStringsValue("", []string{"DD_OTELCOLLECTOR_INSTALLATION_METHOD=bare-metal"}) | ||
| } | ||
|
|
||
| // stopServiceIfExists stops the service if it exists | ||
| func stopServiceIfExists(name string) error { | ||
| // Use robust stop; ignore 'service does not exist' | ||
|
|
@@ -481,6 +502,9 @@ func ensureDDOTServiceForExtension(binaryPath string) error { | |
| return err | ||
| } | ||
| configureDDOTServicePermissions(s) | ||
| if err := setDDOTServiceEnvVars(); err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
|
|
@@ -498,5 +522,8 @@ func ensureDDOTServiceForExtension(binaryPath string) error { | |
| return err | ||
| } | ||
| configureDDOTServicePermissions(s) | ||
| if err := setDDOTServiceEnvVars(); err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.