Skip to content

Commit 56a4e6e

Browse files
authored
Merge pull request #155 from parca-dev/update5
update5
2 parents bff0d78 + cf815f9 commit 56a4e6e

File tree

33 files changed

+210
-134
lines changed

33 files changed

+210
-134
lines changed

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: ./.github/workflows/env
2929

3030
- name: Initialize CodeQL
31-
uses: github/codeql-action/init@96f518a34f7a870018057716cc4d7a5c014bd61c # v3.29.10
31+
uses: github/codeql-action/init@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11
3232
with:
3333
languages: go
3434

@@ -37,7 +37,7 @@ jobs:
3737
make TARGET_ARCH=${{ matrix.target_arch }}
3838
3939
- name: Perform CodeQL Analysis
40-
uses: github/codeql-action/analyze@96f518a34f7a870018057716cc4d7a5c014bd61c # v3.29.10
40+
uses: github/codeql-action/analyze@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11
4141
with:
4242
category: "/language:Go"
4343
timeout-minutes: 10

.github/workflows/ossf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
# Upload the results to GitHub's code scanning dashboard (optional).
4343
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
4444
- name: "Upload to code-scanning"
45-
uses: github/codeql-action/upload-sarif@96f518a34f7a870018057716cc4d7a5c014bd61c # v3.29.10
45+
uses: github/codeql-action/upload-sarif@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11
4646
with:
4747
sarif_file: results.sarif

.github/workflows/push-docker-image.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: "Update builder docker image"
22

33
on:
4+
workflow_dispatch: # Allows manual triggering of the workflow
45
push:
56
branches: ["main"]
67
paths:

.github/workflows/unit-test-on-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
check-binary-blobs:
9191
name: Check for differences in the eBPF binary blobs
9292
runs-on: ubuntu-24.04
93-
container: otel/opentelemetry-ebpf-profiler-dev:latest@sha256:db6081344e85ef95317b19dbf667d56df35812353b23d0fd54e1db0f55436b80
93+
container: otel/opentelemetry-ebpf-profiler-dev:latest@sha256:6ab9b5ff6c2a457be97a389887caf9f3cd5344f760fdab0101b9965236bbb2db
9494
defaults:
9595
run:
9696
shell: bash --login {0}

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli_flags.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ var (
6969
defaultOffCPUThreshold)
7070
envVarsHelp = "Comma separated list of environment variables that will be reported with the" +
7171
"captured profiling samples."
72+
probeLinkHelper = "Attach a probe to a symbol of an executable. " +
73+
"Expected format: /path/to/executable:symbol"
74+
loadProbeHelper = "Load generic eBPF program that can be attached externally to " +
75+
"various user or kernel space hooks."
7276
)
7377

7478
// Package-scope variable, so that conditionally compiled other components can refer
@@ -127,6 +131,13 @@ func parseArgs() (*controller.Config, error) {
127131

128132
fs.StringVar(&args.IncludeEnvVars, "env-vars", defaultEnvVarsValue, envVarsHelp)
129133

134+
fs.Func("uprobe-link", probeLinkHelper, func(link string) error {
135+
args.UProbeLinks = append(args.UProbeLinks, link)
136+
return nil
137+
})
138+
139+
fs.BoolVar(&args.LoadProbe, "load-probe", false, loadProbeHelper)
140+
130141
fs.Usage = func() {
131142
fs.PrintDefaults()
132143
}

internal/controller/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ type Config struct {
3333
VerboseMode bool
3434
Version bool
3535
OffCPUThreshold float64
36+
UProbeLinks []string
37+
LoadProbe bool
3638

3739
Reporter reporter.Reporter
3840

internal/controller/controller.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ func (c *Controller) Start(ctx context.Context) error {
9898
ProbabilisticThreshold: c.config.ProbabilisticThreshold,
9999
OffCPUThreshold: uint32(c.config.OffCPUThreshold * float64(math.MaxUint32)),
100100
IncludeEnvVars: envVars,
101+
UProbeLinks: c.config.UProbeLinks,
102+
LoadProbe: c.config.LoadProbe,
101103
})
102104
if err != nil {
103105
return fmt.Errorf("failed to load eBPF tracer: %w", err)
@@ -125,6 +127,13 @@ func (c *Controller) Start(ctx context.Context) error {
125127
log.Printf("Enabled off-cpu profiling with p=%f", c.config.OffCPUThreshold)
126128
}
127129

130+
if len(c.config.UProbeLinks) > 0 {
131+
if err := trc.AttachUProbes(c.config.UProbeLinks); err != nil {
132+
return fmt.Errorf("failed to attach uprobes: %v", err)
133+
}
134+
log.Printf("Attached uprobes")
135+
}
136+
128137
if c.config.ProbabilisticThreshold < tracer.ProbabilisticThresholdMax {
129138
trc.StartProbabilisticProfiling(ctx)
130139
log.Printf("Enabled probabilistic profiling")

interpreter/apmint/apmint.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"go.opentelemetry.io/ebpf-profiler/host"
2020
"go.opentelemetry.io/ebpf-profiler/interpreter"
2121
"go.opentelemetry.io/ebpf-profiler/libpf"
22-
"go.opentelemetry.io/ebpf-profiler/libpf/pfelf"
2322
"go.opentelemetry.io/ebpf-profiler/remotememory"
2423
"go.opentelemetry.io/ebpf-profiler/support"
2524
)
@@ -65,7 +64,7 @@ func Loader(_ interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interprete
6564
// Resolve process storage symbol.
6665
procStorageSym, err := ef.LookupSymbol(procStorageExport)
6766
if err != nil {
68-
if errors.Is(err, pfelf.ErrSymbolNotFound) {
67+
if errors.Is(err, libpf.ErrSymbolNotFound) {
6968
// APM<->profiling integration not supported by agent.
7069
return nil, nil
7170
}

interpreter/customlabels/customlabels.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"go.opentelemetry.io/ebpf-profiler/interpreter"
1010
"go.opentelemetry.io/ebpf-profiler/libpf"
11-
"go.opentelemetry.io/ebpf-profiler/libpf/pfelf"
1211
"go.opentelemetry.io/ebpf-profiler/remotememory"
1312
"go.opentelemetry.io/ebpf-profiler/support"
1413
)
@@ -44,7 +43,7 @@ func Loader(_ interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interprete
4443
}
4544
abiVersionSym, err := ef.LookupSymbol(abiVersionExport)
4645
if err != nil {
47-
if errors.Is(err, pfelf.ErrSymbolNotFound) {
46+
if errors.Is(err, libpf.ErrSymbolNotFound) {
4847
return nil, nil
4948
}
5049

0 commit comments

Comments
 (0)