Skip to content

Commit 7862394

Browse files
committed
Update to pick up new cpuid metadata
1 parent d59ef5c commit 7862394

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ Using relabeling the following labels can be attached to profiles:
237237
* `__meta_containerd_container_name`: The name of the container the process is running in.
238238
* `__meta_containerd_pod_name`: The name of the pod the process is running in.
239239
* `__meta_lxc_container_id`: The ID of the container the process is running in.
240+
* `__meta_cpuid`: The CPUID the sample was taken on.
240241

241242
## Security
242243

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,4 @@ require (
149149
sigs.k8s.io/yaml v1.3.0 // indirect
150150
)
151151

152-
replace go.opentelemetry.io/ebpf-profiler => github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241119180151-973432074646
152+
replace go.opentelemetry.io/ebpf-profiler => github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241120193926-2195ed9b3e07

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bl
256256
github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
257257
github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU=
258258
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
259-
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241119180151-973432074646 h1:AEpHap6mzMkuL8Qm3wJizUkowWnU2VIFNiXMd2F4TXg=
260-
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241119180151-973432074646/go.mod h1:w5yygcS9iUpFVRk1rgfkBPtfrRql+CRlBBHvbAQXDEk=
259+
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241120193926-2195ed9b3e07 h1:xtBlQNEDZehAUUnAvaoGPRrd/LZrglSai8AhEC8ibFw=
260+
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241120193926-2195ed9b3e07/go.mod h1:w5yygcS9iUpFVRk1rgfkBPtfrRql+CRlBBHvbAQXDEk=
261261
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
262262
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
263263
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=

reporter/parca_reporter.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (r *ParcaReporter) ReportTraceEvent(trace *libpf.Trace,
159159
})
160160
}
161161

162-
labelRetrievalResult := r.labelsForTID(meta.TID, meta.PID, meta.Comm)
162+
labelRetrievalResult := r.labelsForTID(meta.TID, meta.PID, meta.Comm, meta.CPU)
163163

164164
if !labelRetrievalResult.keep {
165165
log.Debugf("Skipping trace event for PID %d, as it was filtered out by relabeling", meta.PID)
@@ -196,7 +196,7 @@ func (r *ParcaReporter) addMetadataForPID(pid libpf.PID, lb *labels.Builder) boo
196196
return cache
197197
}
198198

199-
func (r *ParcaReporter) labelsForTID(tid, pid libpf.PID, comm string) labelRetrievalResult {
199+
func (r *ParcaReporter) labelsForTID(tid, pid libpf.PID, comm string, cpuid int) labelRetrievalResult {
200200
if labels, exists := r.labels.Get(tid); exists {
201201
return labels
202202
}
@@ -205,6 +205,7 @@ func (r *ParcaReporter) labelsForTID(tid, pid libpf.PID, comm string) labelRetri
205205
lb.Set("node", r.nodeName)
206206
lb.Set("__meta_thread_comm", comm)
207207
lb.Set("__meta_thread_id", fmt.Sprint(tid))
208+
lb.Set("__meta_cpuid", fmt.Sprint(cpuid))
208209
cacheable := r.addMetadataForPID(pid, lb)
209210

210211
keep := relabel.ProcessBuilder(lb, r.relabelConfigs...)

0 commit comments

Comments
 (0)