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

Add PID as an attribute in each sample #212

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions reporter/otlp_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ type traceEvents struct {
mappingEnds []libpf.Address
mappingFileOffsets []uint64
timestamps []uint64 // in nanoseconds
pid uint64
florianl marked this conversation as resolved.
Show resolved Hide resolved
}

// attrKeyValue is a helper to populate Profile.attribute_table.
Expand Down Expand Up @@ -185,6 +186,7 @@ func (r *OTLPReporter) ReportTraceEvent(trace *libpf.Trace, meta *TraceEventMeta
mappingEnds: trace.MappingEnd,
mappingFileOffsets: trace.MappingFileOffsets,
timestamps: []uint64{uint64(meta.Timestamp)},
pid: uint64(meta.PID),
}
}

Expand Down Expand Up @@ -652,6 +654,7 @@ func (r *OTLPReporter) getProfile() (profile *profiles.Profile, startTS, endTS u
{key: string(semconv.ContainerIDKey), value: traceKey.containerID},
{key: string(semconv.ThreadNameKey), value: traceKey.comm},
{key: string(semconv.ServiceNameKey), value: traceKey.apmServiceName},
{key: string(semconv.ProcessPIDKey), value: strconv.FormatUint(traceInfo.pid, 10)},
}, attributeMap)
sample.LocationsLength = uint64(len(traceInfo.frameTypes))
locationIndex += sample.LocationsLength
Expand Down