Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to pick up new cpuid metadata #3003

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ Using relabeling the following labels can be attached to profiles:
* `__meta_containerd_container_name`: The name of the container the process is running in.
* `__meta_containerd_pod_name`: The name of the pod the process is running in.
* `__meta_lxc_container_id`: The ID of the container the process is running in.
* `__meta_cpuid`: The CPUID the sample was taken on.

## Security

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace go.opentelemetry.io/ebpf-profiler => github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241119180151-973432074646
replace go.opentelemetry.io/ebpf-profiler => github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241120193926-2195ed9b3e07
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bl
github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU=
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241119180151-973432074646 h1:AEpHap6mzMkuL8Qm3wJizUkowWnU2VIFNiXMd2F4TXg=
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241119180151-973432074646/go.mod h1:w5yygcS9iUpFVRk1rgfkBPtfrRql+CRlBBHvbAQXDEk=
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241120193926-2195ed9b3e07 h1:xtBlQNEDZehAUUnAvaoGPRrd/LZrglSai8AhEC8ibFw=
github.com/parca-dev/opentelemetry-ebpf-profiler v0.0.0-20241120193926-2195ed9b3e07/go.mod h1:w5yygcS9iUpFVRk1rgfkBPtfrRql+CRlBBHvbAQXDEk=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
Expand Down
5 changes: 3 additions & 2 deletions reporter/parca_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (r *ParcaReporter) ReportTraceEvent(trace *libpf.Trace,
})
}

labelRetrievalResult := r.labelsForTID(meta.TID, meta.PID, meta.Comm)
labelRetrievalResult := r.labelsForTID(meta.TID, meta.PID, meta.Comm, meta.CPU)

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

func (r *ParcaReporter) labelsForTID(tid, pid libpf.PID, comm string) labelRetrievalResult {
func (r *ParcaReporter) labelsForTID(tid, pid libpf.PID, comm string, cpuid int) labelRetrievalResult {
if labels, exists := r.labels.Get(tid); exists {
return labels
}
Expand All @@ -205,6 +205,7 @@ func (r *ParcaReporter) labelsForTID(tid, pid libpf.PID, comm string) labelRetri
lb.Set("node", r.nodeName)
lb.Set("__meta_thread_comm", comm)
lb.Set("__meta_thread_id", fmt.Sprint(tid))
lb.Set("__meta_cpuid", fmt.Sprint(cpuid))
cacheable := r.addMetadataForPID(pid, lb)

keep := relabel.ProcessBuilder(lb, r.relabelConfigs...)
Expand Down
Loading