Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
b48db5e
[PROF-9872] Try to use Go buildID if GNU buildID is not present (#7)
nsavoire Jun 3, 2024
c22dbcd
Add test with Go binary built with bazel
nsavoire Sep 6, 2024
c924504
Change symbol reporter interface to allow opening any file (#2)
nsavoire Sep 19, 2024
b6d0b27
Add github action to rebase datadog branch on upstream (#18)
nsavoire Sep 23, 2024
94abf37
Add missing permission (#19)
nsavoire Sep 23, 2024
a151046
Improve actual path returned by systemProcess.Open (#10)
nsavoire Mar 3, 2025
22c33bc
processmanager: pass both go and gnu build ids (#15)
Gandem Apr 16, 2025
7241ff9
Allow zero size for tracehandler cache
nsavoire Apr 27, 2025
45d9612
Avoid using the GITHUB_TOKEN for pr creation (#21)
xopham Aug 1, 2025
86fe06d
Fix repo reference for dd-octo-sts action (#22)
xopham Aug 1, 2025
25ec00d
Remove outdated comment
nsavoire Aug 8, 2025
a6f7c93
ruby interpreter: fix up offsets for 3.3 to 3.5. fallback to symtab l…
manuelfelipe Aug 19, 2025
67738db
ruby interpreter: add ruby 3.3 to 3.5 coredump test files
manuelfelipe Aug 19, 2025
55bfc8c
fix up comment explaining change of size in rb_control_frame
manuelfelipe Aug 20, 2025
06749d6
fix up linter issues
manuelfelipe Aug 21, 2025
acf3d99
fix up ruby interpreter
manuelfelipe Sep 4, 2025
48a965a
Support getting execution context from tls
dalehamel Aug 29, 2025
a12aba6
ruby interpreter: readPathObjRealPath
manuelfelipe Sep 2, 2025
b475fc7
ruby interpreter: add coredump tests with ruby using ractors/multiple…
manuelfelipe Sep 2, 2025
1610d0e
Hardcode module id of 2 for prod, which has jemalloc
dalehamel Sep 16, 2025
4a3aebc
Fix DTV offset calc
dalehamel Sep 16, 2025
2776361
Read ruby class names from cme if available
dalehamel Aug 22, 2025
d6f402a
Fallback to reading iseq body from cfp if unable to process CME
dalehamel Sep 15, 2025
4806c76
Accomodate larger stacks by increasing frames per tail call and incre…
dalehamel Sep 15, 2025
b5570cf
Don't error out when symbolizing, log and fallback to defaults
dalehamel Sep 16, 2025
99180a7
Dynamically determine TLS module id and DTV step from process auxv fo…
dalehamel Sep 17, 2025
fc8e994
Lint fixes
dalehamel Sep 17, 2025
375b958
Support reading c functions
dalehamel Sep 18, 2025
fb828be
Add the validated iseq_body address in frame padding
dalehamel Sep 19, 2025
32276c8
Fallbacks on fallbacks
dalehamel Sep 19, 2025
f68b959
More robust iseq body fallbacks
dalehamel Sep 19, 2025
a131a6f
Add handling for iclass, and notes about singleton classes
dalehamel Sep 19, 2025
1c74984
Class path fixes
dalehamel Sep 22, 2025
22d6929
Support singleton classes
dalehamel Sep 22, 2025
4b64424
Discard classname on error to prevent cross-contamination
dalehamel Sep 22, 2025
120a25a
Fix issue with tail calls in native unwinder
dalehamel Sep 15, 2025
c0d8927
Log if we hit max tail calls
dalehamel Sep 23, 2025
6a3c7db
Load errors.json, use error message as funcname if we don't filter er…
dalehamel Sep 25, 2025
74e6319
Rebuild bpf
dalehamel Sep 25, 2025
82cf1e8
Copy v8 map sync for jit anon mappings to Ruby
dalehamel Sep 25, 2025
2cd96f7
Fix reading method type, only consider 4 bits
dalehamel Sep 25, 2025
dfb4801
Try and fix reading C ids
dalehamel Sep 25, 2025
13bf7f4
Hack for not adding class prefix to blocks
dalehamel Sep 25, 2025
1780243
Try and debug global symbol offset
dalehamel Sep 26, 2025
0517dc7
Refactor symbol code to id2str, handle singletons
dalehamel Sep 26, 2025
1113020
More cfunc fixes
dalehamel Sep 26, 2025
ebe1c24
Try and fix array lookup
dalehamel Sep 26, 2025
37a2f4f
Try pushing cfunc frames
dalehamel Sep 26, 2025
3091727
Try and fix frame ordering for cfuncs
dalehamel Sep 26, 2025
66fe642
Move away from using unstable CFP refs, push CME or EP instead
dalehamel Sep 29, 2025
195da3d
Better identify ruby jit mappings
dalehamel Sep 30, 2025
1599654
Clean up iseq body checks
dalehamel Sep 30, 2025
73bc249
Avoid unrolling loop when walking CFP
dalehamel Sep 30, 2025
faa6932
Try jit unwinding in prod
dalehamel Sep 30, 2025
f6a8925
More native unwinds
dalehamel Sep 30, 2025
0a774d2
Don't unwind native frames after we hit ruby
dalehamel Sep 30, 2025
085a13e
Fully resolve CME in bpf using gotos
dalehamel Sep 30, 2025
5f8d10b
Check method type before pushing to buffer
dalehamel Sep 30, 2025
d20b59d
Fix method entry type check, handle non local first svar case
dalehamel Sep 30, 2025
c3657e7
More fixes
dalehamel Sep 30, 2025
99df4c0
Capture iseq body in bpf
dalehamel Sep 30, 2025
fca9459
Use cfp iseq entry as fallback
dalehamel Sep 30, 2025
bcb10de
Fully resolve iseq body in bpf
dalehamel Sep 30, 2025
bc10bb7
Directly read method type to check
dalehamel Sep 30, 2025
459f93c
More debugging
dalehamel Oct 1, 2025
f089b03
Try method definition reference fallback
dalehamel Oct 1, 2025
3c6e98d
add documentation of imemo
dalehamel Oct 1, 2025
eb24a2c
Support detecting if we are in GC, and skip profiling
dalehamel Oct 1, 2025
bf763fd
clang format
dalehamel Oct 1, 2025
8a836cc
Log more about invalid method defs
dalehamel Oct 1, 2025
71c5ade
Add helper to check error code from remote memory read
dalehamel Oct 1, 2025
0e49190
Add CME cache
dalehamel Oct 1, 2025
27e0907
Yolo increase CME cache, add stats
dalehamel Oct 1, 2025
e7e3626
Try and duplicate rb_profile_frame_full_label
dalehamel Oct 1, 2025
cc3dab4
Fix EP traversal
dalehamel Oct 1, 2025
e90d4f6
Just skip for now if we hit max traversal
dalehamel Oct 1, 2025
aaa358c
Debug by returning named errors
dalehamel Oct 1, 2025
e45c5b7
Fix resolving specval through pointer guard
dalehamel Oct 1, 2025
850ab69
Give it more iterations
dalehamel Oct 1, 2025
30d216c
Reset ep check at each CFP read
dalehamel Oct 2, 2025
54e9266
Implement JIT detection and change unwinding strategies, push jit dum…
dalehamel Oct 2, 2025
7eaf76d
Fix iseq body handling, log ep walks, push dummy frames for dead pid
dalehamel Oct 2, 2025
e981f50
Fix cfunc detection, try and fix lambda and bmethod symbolizing
dalehamel Oct 2, 2025
b5dcd93
Add debug info for unknown functions
dalehamel Oct 2, 2025
e626af8
Correct the type checking logic for checking method type
dalehamel Oct 3, 2025
e0bd873
Basic jit symbol lookup support if perf map is enabled
dalehamel Oct 3, 2025
4bc383b
Don't recheck map repeatedly if jit region didn't change
dalehamel Oct 3, 2025
784a63d
Dereference local iseq before reading label
dalehamel Oct 3, 2025
4ee5002
Doc local iseq
dalehamel Oct 3, 2025
90f897e
Debug local iseqs
dalehamel Oct 3, 2025
f4f30f0
Only resolve local iseq for method name
dalehamel Oct 3, 2025
1013ebc
Iseq debugging and fixes
dalehamel Oct 3, 2025
353d1a3
Pack flags into PC bits, use extra for cfp->iseq, try and fallback to…
dalehamel Oct 3, 2025
7199c9c
Try disabling fallback
dalehamel Oct 3, 2025
332f2f9
Deref iseq body in bpf
dalehamel Oct 3, 2025
9c43919
More error checking and fallback
dalehamel Oct 3, 2025
77bcdd3
Don't fallback for iseq
dalehamel Oct 3, 2025
b405b33
Don't cache iseqs
dalehamel Oct 3, 2025
6654ad6
Debug: disable string cache
dalehamel Oct 3, 2025
7d67c04
Verbose debugging
dalehamel Oct 3, 2025
998292a
Basic testing of ruby module id inspector
dalehamel Oct 8, 2025
9901b53
Document the loader inspector, test basic case
dalehamel Oct 9, 2025
accc125
Add more test cases for loader inspector
dalehamel Oct 9, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
issuer: https://token.actions.githubusercontent.com

subject: repo:DataDog/opentelemetry-ebpf-profiler:ref:refs/heads/datadog

claim_pattern:
event_name: workflow_dispatch
ref: refs/heads/datadog
ref_protected: "true"
job_workflow_ref: DataDog/opentelemetry-ebpf-profiler/.github/workflows/prepare-rebase-on-upstream.yml@refs/heads/datadog

permissions:
pull_requests: write
58 changes: 58 additions & 0 deletions .github/workflows/prepare-rebase-on-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Prepare rebase on upstream
on:
workflow_dispatch:

jobs:
prepare:
runs-on: ubuntu-latest
permissions:
id-token: write # Needed to federate tokens
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
with:
scope: DataDog/opentelemetry-ebpf-profiler
policy: self.prepare-rebase-on-upstream.create-pr
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Do not use `gh repo sync` with GITHUB_TOKEN, it will fail with 422:
# {"message":"Repository rule violations found","documentation_url":"https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository","status":"422"}
- name: Sync main with upstream
run: |
git switch main
git remote add upstream git@github.com:open-telemetry/opentelemetry-ebpf-profiler.git
git fetch upstream
git merge --ff upstream/main
git push origin

- name: Checkout datadog branch
run: |
git switch datadog
git pull

- name: Rebase datadog on main
run: |
git switch -c rebase-on-upstream
git rebase origin/main
git push origin rebase-on-upstream

- name: Create PR
run: |
gh pr create -R ${{ github.repository }} --base main --head rebase-on-upstream --title "Rebase datadog on upstream/main" --body "This PR is to rebase datadog branch on main branch"
env:
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}

- name: Add comment
run: |
gh pr comment rebase-on-upstream -R ${{ github.repository }} --body "Please close and re-open this PR to trigger the tests."
env:
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
80 changes: 80 additions & 0 deletions .github/workflows/rebase-on-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Rebase on upstream

on:
workflow_dispatch:

jobs:
check:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write # need this permission to delete update branch
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Check PR
id: check_pr
run: |
# Check that ${{ github.ref_name }} has main as ancestor (ie. fast forward merge is possible)
if ! git merge-base --is-ancestor origin/main ${{ github.ref_name }}; then
echo "${{ github.ref_name }} does not have main as ancestor"
exit 1
fi

gh pr list --state open --head ${{ github.ref_name }} --base main --json number,reviewDecision,state,isDraft,mergeable,statusCheckRollup > pr.json
# Check that there is a single PR with main as base branch and ${{ github.ref_name }} as head branch
if [[ "$(jq length pr.json)" -eq 0 ]]; then
echo "No PR with main as base branch and ${{ github.ref_name }} as head branch"
exit 1
fi
# No need to check that PR count is greater than 1, because github prevents creating multiple PRs with the same head and base branches

# Check that PR is not draft
if [[ "$(jq '.[0] | .isDraft' pr.json)" == "true" ]]; then
echo "PR is a draft"
exit 1
fi

# Check that PR is mergeable
if [[ "$(jq '.[0] | .mergeable' pr.json)" == "false" ]]; then
echo "PR is not mergeable"
exit 1
fi

# Check that PR is approved
if [[ "$(jq -r '.[0] | .reviewDecision' pr.json)" != "APPROVED" ]]; then
echo "PR is not approved"
exit 1
fi

# Check that PR build is successful, sdm policy check is a bit different from the others
unsuccessful_check_count=$(jq '[.[0] | .statusCheckRollup | .[] | select(.workflowName != null and (.status != "COMPLETED" or .conclusion != "SUCCESS") or (.context != null and .state != "SUCCESS"))] | length' pr.json)
if [[ "$unsuccessful_check_count" -gt 0 ]]; then
echo "PR build is not successful"
exit 1
fi

echo "pr_number=$(jq '.[0] | .number' pr.json)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Rewrite datadog branch
run: |
git checkout datadog
git reset --hard ${{ github.ref_name }}
git push -f

- name: Close PR and delete update branch
run: |
gh pr close -d ${{ steps.check_pr.outputs.pr_number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.15.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/collector/component/componenttest v0.131.0 // indirect
go.opentelemetry.io/collector/consumer v1.37.0 // indirect
Expand All @@ -83,7 +84,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/net v0.40.0 // indirect
golang.org/x/text v0.25.0 // indirect
golang.org/x/text v0.28.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand Down Expand Up @@ -502,6 +504,8 @@ golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand Down
1 change: 1 addition & 0 deletions host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Frame struct {
Lineno libpf.AddressOrLineno
Type libpf.FrameType
ReturnAddress bool
Extra libpf.AddressOrLineno
}

type Trace struct {
Expand Down
5 changes: 1 addition & 4 deletions interpreter/dotnet/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,17 +606,14 @@ func (i *dotnetInstance) SynchronizeMappings(ebpf interpreter.EbpfHandler,
info.simpleName, info.guid)

if !symbolReporter.ExecutableKnown(info.fileID) {
open := func() (process.ReadAtCloser, error) {
return pr.OpenMappingFile(m)
}
symbolReporter.ExecutableMetadata(
&reporter.ExecutableMetadataArgs{
FileID: info.fileID,
FileName: path.Base(m.Path.String()),
GnuBuildID: info.guid,
DebuglinkFileName: "",
Interp: libpf.Dotnet,
Open: open,
Open: pr,
},
)
}
Expand Down
12 changes: 8 additions & 4 deletions interpreter/loaderinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ func (i *LoaderInfo) GetSymbolAsRanges(symbol libpf.SymbolName) ([]util.Range, e
if err != nil {
return nil, fmt.Errorf("symbol '%v' not found: %w", symbol, err)
}
start := uint64(sym.Address)
return i.SymbolAsRanges(sym), nil
}

// SymbolAsRanges returns the normalized virtual address ranges for the named symbol
func (i *LoaderInfo) SymbolAsRanges(symbol *libpf.Symbol) []util.Range {
return []util.Range{{
Start: start,
End: start + sym.Size},
}, nil
Start: uint64(symbol.Address),
End: uint64(symbol.Address) + symbol.Size,
}}
}

// FileID returns the fileID element of the LoaderInfo struct.
Expand Down
Loading