Skip to content
Merged
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
15 changes: 11 additions & 4 deletions flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/alecthomas/kong"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/ebpf-profiler/support"
"go.opentelemetry.io/ebpf-profiler/tracer"
_ "google.golang.org/grpc/encoding/proto"
)
Expand Down Expand Up @@ -122,7 +123,8 @@ type Flags struct {

BPF FlagsBPF `embed:"" prefix:"bpf-"`

OfflineMode FlagsOfflineMode `embed:"" prefix:"offline-mode-"`
OfflineMode FlagsOfflineMode `embed:"" prefix:"offline-mode-"`
OffCPUThreshold uint `default:"0" help:"The per-mille probablity of off-CPU event being recorded."`
}

type ExitCode int
Expand Down Expand Up @@ -202,6 +204,11 @@ func (f Flags) Validate() ExitCode {
return ParseError("Specified --offline-mode-upload without --offline-mode-storage-path.")
}

if f.OffCPUThreshold > support.OffCPUThresholdMax {
return ParseError("Off-CPU threshold %d exceeds limit (max: %d)",
f.OffCPUThreshold, support.OffCPUThresholdMax)
}

return ExitSuccess
}

Expand Down Expand Up @@ -355,7 +362,7 @@ type FlagsBPF struct {
}

type FlagsOfflineMode struct {
StoragePath string `help:"Enables offline mode, with the data stored at the given path."`
RotationInterval time.Duration `default:"10m" help:"How often to rotate and compress the offline mode log."`
Upload bool `help:"Run the uploader for data written in offline mode."`
StoragePath string `help:"Enables offline mode, with the data stored at the given path."`
RotationInterval time.Duration `default:"10m" help:"How often to rotate and compress the offline mode log."`
Upload bool `help:"Run the uploader for data written in offline mode."`
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace go.opentelemetry.io/ebpf-profiler => github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20250306230038-78e858b85337
replace go.opentelemetry.io/ebpf-profiler => github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20250311092013-ec1cdb3482af
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bl
github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU=
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20250306230038-78e858b85337 h1:qJ3p+TmnDFPAX+XhBSHpgnETRofp8Yn6FzOBfwxKzyc=
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20250306230038-78e858b85337/go.mod h1:q15sN2PgXSh337bNjdeUz4WCIlqQrO/Nx0H5O7o5WiI=
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20250311092013-ec1cdb3482af h1:2MhE8xUeyjPux1INz/40WEt7raxzUNMiRfGSNIb7gc0=
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20250311092013-ec1cdb3482af/go.mod h1:q15sN2PgXSh337bNjdeUz4WCIlqQrO/Nx0H5O7o5WiI=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ func mainWithExitCode() flags.ExitCode {
ProbabilisticInterval: f.Profiling.ProbabilisticInterval,
ProbabilisticThreshold: f.Profiling.ProbabilisticThreshold,
CollectCustomLabels: f.CollectCustomLabels,
OffCPUThreshold: uint32(f.OffCPUThreshold),
})
if err != nil {
return flags.Failure("Failed to load eBPF tracer: %v", err)
Expand Down
Loading