Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .copyright-overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ github.com/ryanuber/go-glob: "Copyright (c) 2014 Ryan Uber"
github.com/sirupsen/logrus: "Copyright (c) 2014 Simon Eskildsen"
github.com/open-telemetry/*: Copyright The OpenTelemetry Authors
github.com/pb33f/*: Copyright pb33f - Princess Beef Heavy Industries
github.com/parca-dev/usdt: Copyright The Parca Authors
go.etcd.io/*: Copyright 2016 The etcd Authors
google.golang.org/appengine: Copyright 2011 Google Inc. All rights reserved.
google.golang.org/appengine/*: Copyright 2011 Google Inc. All rights reserved.
Expand Down
2 changes: 2 additions & 0 deletions .wwhrd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ overrides:
# https://github.com/nexus-rpc/api/blob/main/LICENSE
# https://github.com/nexus-rpc/sdk-go/blob/main/LICENSE
"github.com/nexus-rpc/nexus-proto-annotations/go/nexusannotations/v1": MIT
# https://github.com/parca-dev/usdt/blob/v0.0.2/LICENSE
"github.com/parca-dev/usdt": Apache-2.0

exceptions:
- "golang.org/x/tools/..."
Expand Down
1 change: 1 addition & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2141,6 +2141,7 @@ core,github.com/package-url/packageurl-go,MIT,Copyright (c) the purl authors
core,github.com/pandatix/go-cvss/30,MIT,Copyright (c) 2022 Lucas TESSON - PandatiX <lucastesson@protonmail.com>
core,github.com/pandatix/go-cvss/31,MIT,Copyright (c) 2022 Lucas TESSON - PandatiX <lucastesson@protonmail.com>
core,github.com/pandatix/go-cvss/40,MIT,Copyright (c) 2022 Lucas TESSON - PandatiX <lucastesson@protonmail.com>
core,github.com/parca-dev/usdt,Apache-2.0,Copyright The Parca Authors
core,github.com/patrickmn/go-cache,MIT,Alex Edwards <ajmedwards@gmail.com> | Copyright (c) 2012-2017 Patrick Mylund Nielsen and the go-cache contributors | Dustin Sallings <dustin@spy.net> | Jason Mooberry <jasonmoo@me.com> | Sergey Shepelev <temotor@gmail.com>
core,github.com/pb33f/jsonpath/pkg/jsonpath,Apache-2.0,Copyright pb33f - Princess Beef Heavy Industries
core,github.com/pb33f/jsonpath/pkg/jsonpath/config,Apache-2.0,Copyright pb33f - Princess Beef Heavy Industries
Expand Down
10 changes: 10 additions & 0 deletions cmd/host-profiler/deploy/bundled/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ The following settings can be overridden in the Datadog Agent configuration for
|:---------------------------------------|:------------------|:----------|:-----------------------------------------------------------------------------------------------------------|
| `hostprofiler.additional_http_headers` | map[string]string | _(empty)_ | Adds custom headers to profile export requests, for example when required by an outbound proxy or gateway. |

### Experimental profiler controls

These options expose experimental OpenTelemetry eBPF Profiler features. Use them only when testing a Host Profiler image built with matching profiler support.

| Name | Values | Default | Description |
|:-------------------------------------|:-------|:-------------|:--------------------------------------------------------------------------------------------------------------------|
| `hostprofiler.heap_profiling` | bool | `false` | Enables heap allocation profiling in the eBPF profiler receiver. |
| `hostprofiler.live_heap_profiling` | bool | `false` | Enables live heap tracking in addition to allocation profiling. Requires `hostprofiler.heap_profiling` to be `true`. |
| `hostprofiler.tracers` | string | profiler default | Comma-separated interpreter tracer list passed to the eBPF profiler receiver. |

### Host Profiler self-profiling

These options are for Datadog Support diagnostics only. Leave self-profiling disabled unless Datadog Support asks you to enable it.
Expand Down
2 changes: 1 addition & 1 deletion cmd/host-profiler/deploy/bundled/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Deploy the Datadog Agent with the Datadog Helm chart version **3.220.0** or late
datadog:
hostProfiler:
enabled: true
image: "registry.datadoghq.com/ddot-ebpf:7.81.0-preview-host-profiler-1.0"
image: "registry.datadoghq.com/ddot-ebpf:dev-hp-preview-1.0-09ad4bc1-zstd-nydus"
agents:
containers:
hostProfiler:
Expand Down
2 changes: 1 addition & 1 deletion cmd/host-profiler/deploy/bundled/operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
# Enable the Host Profiler sidecar and set the preview Host Profiler image.
agent.datadoghq.com/host-profiler-enabled: "true"
experimental.agent.datadoghq.com/image-override-config: |
{"host-profiler": {"name": "registry.datadoghq.com/ddot-ebpf:7.81.0-preview-host-profiler-1.0"}}
{"host-profiler": {"name": "registry.datadoghq.com/ddot-ebpf:dev-hp-preview-1.0-09ad4bc1-zstd-nydus"}}
spec:
override:
nodeAgent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mode: daemonset
# Host Profiler preview image. Update the tag when using a newer preview build.
image:
repository: registry.datadoghq.com/ddot-ebpf
tag: 7.81.0-preview-host-profiler-1.0
tag: dev-hp-preview-1.0-09ad4bc1-zstd-nydus

# Environment variables used by helm/collector-config-values.yaml.
extraEnvs:
Expand Down
4 changes: 2 additions & 2 deletions cmd/host-profiler/deploy/standalone/operator/collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
mode: daemonset

# Host Profiler preview image. Update the tag when using a newer preview build.
image: registry.datadoghq.com/ddot-ebpf:7.81.0-preview-host-profiler-1.0
image: registry.datadoghq.com/ddot-ebpf:dev-hp-preview-1.0-09ad4bc1-zstd-nydus

# Required for host-level process visibility.
hostPID: true
Expand Down Expand Up @@ -180,7 +180,7 @@ spec:
# The main container references this profile through securityContext.seccompProfile.
initContainers:
- name: seccomp-installer
image: registry.datadoghq.com/ddot-ebpf:7.81.0-preview-host-profiler-1.0
image: registry.datadoghq.com/ddot-ebpf:dev-hp-preview-1.0-09ad4bc1-zstd-nydus
command:
- cp
- /etc/dd-host-profiler/seccomp.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func buildReceivers(conf confMap, agent configManager) []any {

profiling := make(confMap)
_ = confmaputils.Set(profiling, "symbol_uploader::enabled", true)
if agent.hostProfilerConfig.HeapProfiling {
profiling["heap_profiling"] = true
}
if agent.hostProfilerConfig.LiveHeapProfiling {
profiling["live_heap_profiling"] = true
}
if agent.hostProfilerConfig.Tracers != "" {
profiling["tracers"] = agent.hostProfilerConfig.Tracers
}

symbolEndpoints := make([]any, 0, agent.endpointsTotalLength)
for _, endpoint := range agent.endpoints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ func TestBuildExportersNoAdditionalHTTPHeaders(t *testing.T) {
assert.Len(t, headers, 4) // dd-api-key, dd-evp-origin, dd-evp-origin-version, resource_as_attributes
}

func TestBuildReceiversHeapProfiling(t *testing.T) {
agent := configManager{
hostProfilerConfig: hostProfilerConfig{
HeapProfiling: true,
LiveHeapProfiling: true,
Tracers: "native",
},
}
conf := make(confMap)
buildReceivers(conf, agent)

receivers, ok := conf["receivers"].(confMap)
require.True(t, ok)
profiling, ok := receivers["profiling"].(confMap)
require.True(t, ok)
assert.Equal(t, true, profiling["heap_profiling"])
assert.Equal(t, true, profiling["live_heap_profiling"])
assert.Equal(t, "native", profiling["tracers"])
}

func TestBuildConfigDDProfilingEnabled(t *testing.T) {
agent := configManager{
endpoints: []endpoint{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ type hostProfilerConfig struct {
DebugVerbosity string
AdditionalHTTPHeaders map[string]string
DDProfiling ddProfilingConfig
HeapProfiling bool
LiveHeapProfiling bool
Tracers string
HealthMetrics healthMetricsConfig
HPFlare hpFlareConfig
}
Expand Down Expand Up @@ -104,6 +107,9 @@ func newConfigManager(config config.Component) configManager {
Period: config.GetInt("hostprofiler.ddprofiling.period"),
Port: config.GetInt("hostprofiler.ddprofiling.port"),
},
HeapProfiling: config.GetBool("hostprofiler.heap_profiling"),
LiveHeapProfiling: config.GetBool("hostprofiler.live_heap_profiling"),
Tracers: config.GetString("hostprofiler.tracers"),
HealthMetrics: healthMetricsConfig{
Enabled: config.GetBool("hostprofiler.health_metrics.enabled"),
Target: config.GetString("hostprofiler.health_metrics.target"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,38 @@ site: datadoghq.com
assert.Equal(t, 0, mgr.hostProfilerConfig.DDProfiling.Port)
}

func TestNewConfigManagerExperimentalProfilerControlsFromYAML(t *testing.T) {
cfg := config.NewMockFromYAML(t, `
api_key: test-key
site: datadoghq.com
hostprofiler:
heap_profiling: true
live_heap_profiling: true
tracers: native,python
`)
mgr := newConfigManager(cfg)

assert.True(t, mgr.hostProfilerConfig.HeapProfiling)
assert.True(t, mgr.hostProfilerConfig.LiveHeapProfiling)
assert.Equal(t, "native,python", mgr.hostProfilerConfig.Tracers)
}

func TestNewConfigManagerExperimentalProfilerControlsFromEnvVar(t *testing.T) {
t.Setenv("DD_HOSTPROFILER_HEAP_PROFILING", "true")
t.Setenv("DD_HOSTPROFILER_LIVE_HEAP_PROFILING", "true")
t.Setenv("DD_HOSTPROFILER_TRACERS", "native,python")

cfg := config.NewMockFromYAML(t, `
api_key: test-key
site: datadoghq.com
`)
mgr := newConfigManager(cfg)

assert.True(t, mgr.hostProfilerConfig.HeapProfiling)
assert.True(t, mgr.hostProfilerConfig.LiveHeapProfiling)
assert.Equal(t, "native,python", mgr.hostProfilerConfig.Tracers)
}

func TestNewConfigManagerHPFlarePortFromYAML(t *testing.T) {
cfg := config.NewMockFromYAML(t, `
api_key: test-key
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ replace (
github.com/spf13/viper => github.com/spf13/viper v1.20.1
// To update the Datadog/opentelemetry-ebpf-profiler dependency on latest commit on datadog branch, change the following line to:
// replace go.opentelemetry.io/ebpf-profiler => github.com/DataDog/opentelemetry-ebpf-profiler datadog
// and run `GOPROXY="" go mod tidy` then `dda inv tidy`
go.opentelemetry.io/ebpf-profiler => github.com/DataDog/opentelemetry-ebpf-profiler v0.0.0-20260710090740-d9125b4c5568
// and run `go mod tidy` then `dda inv tidy`
go.opentelemetry.io/ebpf-profiler => github.com/DataDog/opentelemetry-ebpf-profiler v0.0.0-20260717072302-4a9b869ea846
)

require (
Expand Down Expand Up @@ -963,6 +963,7 @@ require (
github.com/package-url/packageurl-go v0.1.3 // indirect
github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c // indirect
github.com/pandatix/go-cvss v0.6.2 // indirect
github.com/parca-dev/usdt v0.0.2 // indirect
github.com/pb33f/jsonpath v0.8.2 // indirect
github.com/pb33f/libopenapi v0.37.2 // indirect
github.com/pb33f/ordered-map/v2 v2.3.1 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions pkg/config/schema/yaml/core_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8658,6 +8658,19 @@ properties:
node_type: setting
type: string
default: ''
comment: Host Profiler config
heap_profiling:
node_type: setting
type: boolean
default: false
live_heap_profiling:
node_type: setting
type: boolean
default: false
tracers:
node_type: setting
type: string
default: ''
health_metrics:
node_type: section
type: object
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/setup/common_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,9 @@ func initCoreAgentFull(config pkgconfigmodel.Setup) {
config.BindEnvAndSetDefault("hostprofiler.ddprofiling.enabled", false)
config.BindEnvAndSetDefault("hostprofiler.ddprofiling.period", 0)
config.BindEnvAndSetDefault("hostprofiler.ddprofiling.port", 0)
config.BindEnvAndSetDefault("hostprofiler.heap_profiling", false)
config.BindEnvAndSetDefault("hostprofiler.live_heap_profiling", false)
config.BindEnvAndSetDefault("hostprofiler.tracers", "")
config.BindEnvAndSetDefault("hostprofiler.health_metrics.enabled", true)
config.BindEnvAndSetDefault("hostprofiler.health_metrics.target", "127.0.0.1:8889")
config.BindEnvAndSetDefault("hostprofiler.hpflare.port", 7778)
Expand Down
Loading