Skip to content

Commit d388f92

Browse files
committed
Merge with upstream
1 parent 18f6907 commit d388f92

File tree

189 files changed

+16376
-3804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+16376
-3804
lines changed

.github/workflows/env/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ runs:
2727
sudo dpkg --add-architecture arm64
2828
sudo apt-get update -y
2929
30-
sudo apt-get install -y llvm clang dwz curl unzip gcc-aarch64-linux-gnu \
30+
sudo apt-get install -y curl unzip gcc-aarch64-linux-gnu \
3131
libc6-arm64-cross qemu-user-binfmt libc6:arm64

.github/workflows/fossa.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: FOSSA scanning
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
fossa:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
17+
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
18+
with:
19+
api-key: ${{secrets.FOSSA_API_KEY}}
20+
team: OpenTelemetry
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "Update builder docker image"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- "Dockerfile"
8+
9+
jobs:
10+
build-and-push:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
- name: Set up environment
16+
uses: ./.github/workflows/env
17+
- name: Login to Docker Hub
18+
uses: docker/login-action@v3
19+
with:
20+
username: ${{ secrets.DOCKER_USERNAME }}
21+
password: ${{ secrets.DOCKER_PASSWORD }}
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
- name: Set current timestamp tag
27+
id: tag
28+
run: |
29+
echo "tag=$(date +%Y%m%d%H%M)" >> $GITHUB_OUTPUT
30+
- name: Build and push
31+
uses: docker/build-push-action@v6
32+
with:
33+
push: true
34+
file: Dockerfile
35+
platforms: linux/amd64,linux/arm64
36+
tags: otel/opentelemetry-ebpf-profiler-dev:latest,otel/opentelemetry-ebpf-profiler-dev:${{ steps.tag.outputs.tag }}

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

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: "1.23"
21+
go-version-file: go.mod
2222
check-latest: true
2323
cache-dependency-path: go.sum
2424
id: go
@@ -30,27 +30,6 @@ jobs:
3030
exit 1
3131
fi
3232
33-
tracer:
34-
name: Check that tracer is up-to-date
35-
runs-on: ubuntu-24.04
36-
strategy:
37-
matrix:
38-
target_arch: [amd64, arm64]
39-
steps:
40-
- name: Clone code
41-
uses: actions/checkout@v4
42-
- name: Set up environment
43-
uses: ./.github/workflows/env
44-
- name: Check that tracer is up-to-date
45-
env:
46-
TARGET_ARCH: ${{ matrix.target_arch }}
47-
run: |
48-
make -C support/ebpf
49-
if [ -n "$(git status --porcelain)" ]; then
50-
echo "run \"make -C support/ebpf\"."
51-
exit 1
52-
fi
53-
5433
lint:
5534
name: Lint (${{ matrix.target_arch }})
5635
runs-on: ubuntu-24.04
@@ -65,7 +44,7 @@ jobs:
6544
- name: Set up Go
6645
uses: actions/setup-go@v5
6746
with:
68-
go-version: "1.23"
47+
go-version-file: go.mod
6948
check-latest: true
7049
cache-dependency-path: go.sum
7150
id: go
@@ -79,6 +58,11 @@ jobs:
7958
CGO_ENABLED: 1
8059
with:
8160
version: ${{ steps.linter-version.outputs.version }}
61+
- name: Lint eBPF code
62+
run: |
63+
sudo apt update
64+
sudo apt install -y clang-format-17
65+
make lint -C support/ebpf
8266
8367
test:
8468
name: Test (${{ matrix.target_arch }})
@@ -102,8 +86,56 @@ jobs:
10286
- name: Tests
10387
run: make test TARGET_ARCH=${{ matrix.target_arch }}
10488

89+
test-rust:
90+
name: Test rust components
91+
runs-on: ubuntu-24.04
92+
steps:
93+
- name: Clone code
94+
uses: actions/checkout@v4
95+
- name: Install Rust
96+
uses: dtolnay/rust-toolchain@stable
97+
- name: Install protoc
98+
env:
99+
PB_URL: "https://github.com/protocolbuffers/protobuf/releases/download/v24.4/"
100+
PB_FILE: "protoc-24.4-linux-x86_64.zip"
101+
INSTALL_DIR: "/usr/local"
102+
run: |
103+
wget -q "$PB_URL/$PB_FILE"
104+
sudo unzip "$PB_FILE" -d "$INSTALL_DIR" 'bin/*' 'include/*'
105+
sudo chmod +xr "$INSTALL_DIR/bin/protoc"
106+
sudo find "$INSTALL_DIR/include" -type d -exec chmod +x {} \;
107+
sudo find "$INSTALL_DIR/include" -type f -exec chmod +r {} \;
108+
rm "$PB_FILE"
109+
- name: Tests
110+
run: |
111+
cargo test
112+
113+
check-ebpf-blobs:
114+
name: Check for differences in the eBPF binary blobs
115+
runs-on: ubuntu-24.04
116+
container: otel/opentelemetry-ebpf-profiler-dev:latest
117+
steps:
118+
- name: Clone code
119+
uses: actions/checkout@v4
120+
- name: Hash eBPF blobs
121+
run: |
122+
sha256sum support/ebpf/tracer.ebpf.release.* > ebpf-blobs.hash
123+
cat ebpf-blobs.hash
124+
- name: Rebuild eBPF blobs
125+
run: |
126+
rm support/ebpf/tracer.ebpf.release.*
127+
make amd64 -C support/ebpf
128+
make arm64 -C support/ebpf
129+
- name: Check for differences
130+
run: |
131+
if ! sha256sum --check ebpf-blobs.hash; then
132+
echo "Please rebuild and commit the updated eBPF binary blobs."
133+
exit 1
134+
fi
135+
136+
105137
build-integration-test-binaries:
106-
name: Build integration test binaries (${{ matrix.target_arch }})
138+
name: Build integration test binaries (${{ matrix.target_arch }}-go${{ matrix.go_version}})
107139
runs-on: ubuntu-24.04
108140
timeout-minutes: 10
109141
strategy:
@@ -131,7 +163,7 @@ jobs:
131163
path: support/*.test
132164

133165
integration-tests:
134-
name: Integration tests (v${{ matrix.kernel }} ${{ matrix.target_arch }})
166+
name: Integration tests (v${{ matrix.kernel }} ${{ matrix.target_arch }} ${{ matrix.go_version}})
135167
runs-on: ubuntu-24.04
136168
needs: build-integration-test-binaries
137169
timeout-minutes: 10
@@ -159,10 +191,9 @@ jobs:
159191
steps:
160192
- name: Clone code
161193
uses: actions/checkout@v4
162-
- name: Set up environment
163-
uses: ./.github/workflows/env
164194
- name: Install dependencies
165195
run: |
196+
sudo apt-get update
166197
case "${{ matrix.target_arch }}" in
167198
amd64) sudo apt-get -y install qemu-system-x86;;
168199
arm64) sudo apt-get -y install qemu-system-arm;;

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/go
66
ebpf-profiler
77
ci-kernels
8+
/target

.golangci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ issues:
2727
- virt-tests
2828
- vm-images
2929

30+
# Excluding configuration per-path, per-linter, per-text and per-source
31+
exclude-rules:
32+
# Don't complain about integer overflows
33+
- text: "G115:"
34+
linters:
35+
- gosec
36+
3037
linters:
3138
enable-all: true
3239
disable:
@@ -58,7 +65,6 @@ linters:
5865
- godot
5966
- godox # complains about TODO etc
6067
- gofumpt
61-
- gomnd
6268
- gomoddirectives
6369
- inamedparam
6470
- interfacebloat
@@ -86,7 +92,7 @@ linters:
8692
- wsl
8793
- wrapcheck
8894
# the following linters are deprecated
89-
- execinquery
95+
- exportloopref
9096
# we don't want to change code to Go 1.22+ yet
9197
- intrange
9298
- copyloopvar

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ get invited to meetings.
1818
See the [#otel-profiles](https://cloud-native.slack.com/archives/C03J794L0BV)
1919
slack channel for discussions and questions.
2020

21+
## Pre-requisites
22+
23+
- Linux (4.19+ for x86-64, 5.5+ for ARM64) with eBPF enabled (the profiler currently only runs on Linux)
24+
- Go as specified in [go.mod](https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/main/go.mod)
25+
- docker
26+
- Rust as specified in [Cargo.toml](https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/main/Cargo.toml)
27+
2128
## Development
2229

2330
You can view and edit the source code by cloning this repository:

0 commit comments

Comments
 (0)