Skip to content

Commit af4ab26

Browse files
authored
Merge pull request #54 from parca-dev/go-fix
Fix go labels metrics collection
2 parents d4bc9af + f3a760b commit af4ab26

File tree

5 files changed

+26
-30
lines changed

5 files changed

+26
-30
lines changed

support/ebpf/go_labels.ebpf.c

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,12 @@ process_bucket(PerCPURecord *record, void *label_buckets, int j)
4646
return false;
4747
}
4848

49-
process_value(map_value, out, 0);
50-
process_value(map_value, out, 1);
51-
process_value(map_value, out, 2);
52-
process_value(map_value, out, 3);
53-
process_value(map_value, out, 4);
54-
process_value(map_value, out, 5);
55-
process_value(map_value, out, 6);
56-
process_value(map_value, out, 7);
49+
#pragma unroll
50+
for (int i = 0; i < 8; i++) {
51+
process_value(map_value, out, i);
52+
}
5753

58-
return false;
54+
return true;
5955
}
6056

6157
static inline __attribute__((__always_inline__)) void
@@ -167,38 +163,38 @@ static inline __attribute__((__always_inline__)) bool get_go_custom_labels_from_
167163
u64 bucket_count = MIN(MAX_CUSTOM_LABELS, 1 << log_2_bucket_count);
168164
switch (bucket_count) {
169165
case 10:
170-
if (process_bucket(record, label_buckets, 9))
171-
return true;
166+
if (!process_bucket(record, label_buckets, 9))
167+
return false;
172168
case 9:
173-
if (process_bucket(record, label_buckets, 8))
174-
return true;
169+
if (!process_bucket(record, label_buckets, 8))
170+
return false;
175171
case 8:
176-
if (process_bucket(record, label_buckets, 7))
177-
return true;
172+
if (!process_bucket(record, label_buckets, 7))
173+
return false;
178174
case 7:
179-
if (process_bucket(record, label_buckets, 6))
180-
return true;
175+
if (!process_bucket(record, label_buckets, 6))
176+
return false;
181177
case 6:
182-
if (process_bucket(record, label_buckets, 5))
183-
return true;
178+
if (!process_bucket(record, label_buckets, 5))
179+
return false;
184180
case 5:
185-
if (process_bucket(record, label_buckets, 4))
186-
return true;
181+
if (!process_bucket(record, label_buckets, 4))
182+
return false;
187183
case 4:
188-
if (process_bucket(record, label_buckets, 3))
189-
return true;
184+
if (!process_bucket(record, label_buckets, 3))
185+
return false;
190186
case 3:
191-
if (process_bucket(record, label_buckets, 2))
192-
return true;
187+
if (!process_bucket(record, label_buckets, 2))
188+
return false;
193189
case 2:
194-
if (process_bucket(record, label_buckets, 1))
195-
return true;
190+
if (!process_bucket(record, label_buckets, 1))
191+
return false;
196192
case 1:
197-
if (process_bucket(record, label_buckets, 0))
198-
return true;
193+
if (!process_bucket(record, label_buckets, 0))
194+
return false;
199195
}
200196

201-
return false;
197+
return true;
202198
}
203199

204200
// Go processes store the current goroutine in thread local store. From there
-18.3 KB
Binary file not shown.
-18.3 KB
Binary file not shown.
688 Bytes
Binary file not shown.
696 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)