Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
fix: arm64 native build (#1252)
Chris Birkhold16d788c74798
diff --git a/.github/workflows/otel-gpu-collector-tests.yml b/.github/workflows/otel-gpu-collector-tests.ymlindex 38179680..e9a01370 100644--- a/.github/workflows/otel-gpu-collector-tests.yml+++ b/.github/workflows/otel-gpu-collector-tests.yml@@ -100,3 +100,44 @@ jobs:GOOS: windowsGOARCH: amd64run: go build ./...++ # Native arm64 build. The above `Test` only cross-compiles arm64,+ # so it never exercises arm64 eBPF generation: tracer.sh on an+ # arm64 host dumps arm64 kernel BTF into vmlinux.h and compiles+ # the BPF object against it. This job validates that path end to+ # end on a native arm64 runner.+ test-arm64:+ name: Test (arm64 native)+ runs-on: ubuntu-24.04-arm+ steps:+ - uses: actions/checkout@v6++ - uses: actions/setup-go@v6+ with:+ go-version-file: opentelemetry-gpu-collector/go.mod+ cache-dependency-path: opentelemetry-gpu-collector/go.sum++ - name: Install eBPF build dependencies+ run: |+ sudo apt-get update -q+ sudo apt-get install -y clang llvm libbpf-dev+ # Download static bpftool binary from libbpf/bpftool releases — avoids+ # linux-tools-$(uname -r) which fails on azure/custom kernels.+ BPFTOOL_VERSION=$(curl -fsSL https://api.github.com/repos/libbpf/bpftool/releases/latest \+ | jq -r .tag_name)+ curl -fsSL "https://github.com/libbpf/bpftool/releases/download/${BPFTOOL_VERSION}/bpftool-${BPFTOOL_VERSION}-arm64.tar.gz" \+ | sudo tar -xz -C /usr/local/bin/+ sudo chmod +x /usr/local/bin/bpftool+ bpftool version++ - name: Generate eBPF objects+ working-directory: opentelemetry-gpu-collector+ run: make setup-bpf generate++ - name: Run tests+ working-directory: opentelemetry-gpu-collector+ run: go test ./...++ - name: Build linux/arm64 (native eBPF path)+ working-directory: opentelemetry-gpu-collector+ run: go build ./...diff --git a/opentelemetry-gpu-collector/internal/ebpf/tracer.go b/opentelemetry-gpu-collector/internal/ebpf/tracer.goindex 1396ef3d..37ef5ab6 100644--- a/opentelemetry-gpu-collector/internal/ebpf/tracer.go+++ b/opentelemetry-gpu-collector/internal/ebpf/tracer.go@@ -19,7 +19,8 @@ import ("github.com/cilium/ebpf/ringbuf")-//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang -target amd64,arm64 gpuevent ./bpf/gpuevent.c -- -I./bpf+// tracer.sh picks the bpf2go target arches from the host arch.+//go:generate ./tracer.sh// Tracer manages eBPF programs for CUDA runtime interception.type Tracer struct {diff --git a/opentelemetry-gpu-collector/internal/ebpf/tracer.sh b/opentelemetry-gpu-collector/internal/ebpf/tracer.shnew file mode 100755index 00000000..87cb3d1b--- /dev/null+++ b/opentelemetry-gpu-collector/internal/ebpf/tracer.sh@@ -0,0 +1,24 @@+#!/usr/bin/env bash++# Host-arch-aware bpf2go wrapper, invoked by the //go:generate+# directive in tracer.go.+#+# setup-bpf dumps the *host* kernel BTF into a single vmlinux.h,+# which is inherently single-arch. libbpf's arm64 register path+# reads a separate `struct user_pt_regs` (which the setup-bpf+# shim in Makefile supplies), so an x86 host can cross-generate+# arm64. The x86 path reads members straight off `struct pt_regs`+# so an arm64 host cannot generate the x86 object. Derive the+# target list from the host arch accordingly.++set -e++goarch="$(go env GOARCH)"+if [ "$goarch" = amd64 ]; then+ targets=amd64,arm64+else+ targets="$goarch"+fi++exec go run github.com/cilium/ebpf/cmd/bpf2go -cc clang \+ -target "$targets" gpuevent ./bpf/gpuevent.c -- -I./bpf