Skip to content

Commit 9038631

Browse files
committed
debug
1 parent 3909f87 commit 9038631

File tree

3 files changed

+80
-4
lines changed

3 files changed

+80
-4
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CX build and push
2+
3+
on:
4+
push:
5+
branches: [ 'main', 'matt/bpf-loop-fallback' ]
6+
pull_request:
7+
branches: [ 'matt/bpf-loop-fallback' ]
8+
9+
env:
10+
AWS_REGION: eu-west-1
11+
AWS_ACCOUNT_ID: 897729105761 # tacotaco-research
12+
AWS_ROLE_TO_ASSUME: arn:aws:iam::897729105761:role/AnemiaAgentRole
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
if: github.repository == 'coralogix/opentelemetry-ebpf-instrumentation'
18+
permissions:
19+
id-token: write
20+
packages: write
21+
contents: read
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Configure AWS credentials
28+
uses: aws-actions/configure-aws-credentials@v4
29+
with:
30+
role-to-assume: ${{ env.AWS_ROLE_TO_ASSUME }}
31+
aws-region: ${{ env.AWS_REGION }}
32+
33+
- name: Login to Amazon ECR
34+
id: login-ecr
35+
run: |
36+
aws ecr get-login-password --region ${{ env.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com
37+
38+
- name: Create ECR Repositories
39+
run: |
40+
aws ecr create-repository --repository-name "obi-internal" --region ${{ env.AWS_REGION }} || echo "Repository obi-internal already exists."
41+
42+
- name: Set up buildx
43+
uses: docker/setup-buildx-action@v3
44+
with:
45+
driver: docker-container
46+
47+
- name: Cache images
48+
uses: actions/cache@v3
49+
with:
50+
path: /tmp/.buildx-cache
51+
key: ${{ runner.os }}-buildx-${{ github.sha }}
52+
restore-keys: |
53+
${{ runner.os }}-buildx-
54+
55+
- name: Set Git Commit Hash
56+
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
57+
58+
- name: Build and push
59+
uses: docker/build-push-action@v6
60+
with:
61+
platforms: linux/amd64,linux/arm64
62+
context: .
63+
file: ./Dockerfile
64+
push: true
65+
tags: |
66+
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/obi-internal:${{ env.COMMIT_HASH }}
67+
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/obi-internal:latest
68+
cache-from: type=local,src=/tmp/.buildx-cache
69+
cache-to: type=local,dest=/tmp/.buildx-cache,new=true

bpf/common/trace_common.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static __always_inline void trace_key_from_pid_tid(trace_key_t *t_key) {
5555
t_key->extra_id = extra_id;
5656
}
5757

58-
static __hidden int tp_match(u32 index, void *data) {
58+
static int tp_match(u32 index, void *data) {
5959
if (index >= (TRACE_BUF_SIZE - TRACE_PARENT_HEADER_LEN)) {
6060
return 1;
6161
}
@@ -94,9 +94,8 @@ static __always_inline unsigned char *bpf_strstr_tp_loop__legacy(unsigned char *
9494
return NULL;
9595
}
9696

97-
const u16 k_besteffort_max_loops = 450; // Limit search to avoid burning too many instructions
97+
const u16 k_besteffort_max_loops = 450; // Limited search to avoid burning too many instructions
9898
for (u16 i = 0; i + TRACE_PARENT_HEADER_LEN < k_besteffort_max_loops; i++) {
99-
// Only check at offset=0 or after '\n' to save instructions
10099
if (i != 0 && buf[i - 1] != '\n') {
101100
continue;
102101
}

pkg/components/ebpf/generictracer/generictracer.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,15 @@ func (p *Tracer) Load() (*ebpf.CollectionSpec, error) {
149149
p.log.Info("Enabling trace information parsing", "bpf_loop_enabled", ebpfcommon.SupportsEBPFLoops(p.log, p.cfg.EBPF.OverrideBPFLoopEnabled))
150150
}
151151

152-
return loader()
152+
spec, err := loader()
153+
if err != nil {
154+
fmt.Println("GREPME: Error loading BPF objects: ", err)
155+
} else {
156+
culprit := spec.Programs["obi_protocol_http"]
157+
fmt.Println("GREPME refs: ", culprit.Instructions.FunctionReferences(), len(culprit.Instructions.FunctionReferences()))
158+
}
159+
160+
return spec, err
153161
}
154162

155163
func (p *Tracer) SetupTailCalls() {

0 commit comments

Comments
 (0)