diff --git a/README.md b/README.md index 5f3c1bd1..3922aa8a 100644 --- a/README.md +++ b/README.md @@ -91,9 +91,9 @@ devfiler spins up a local server that listens on `0.0.0.0:11000`. To run it, simply download and unpack the archive from the following URL: -https://upload.elastic.co/d/87e7697991940ec37f0c6e39ac38d213f65e8dc1ef9dbedff6aab9cba0adfaba +https://upload.elastic.co/d/f8aa0c386baa808a616ca29f86b34c726edb5af36f8840a4cf28468ad534a4b5 -Authentication token: `c74dfc4db2212015` +Authentication token: `2635c0750bf8ea69` The archive contains a build for each of the following platforms: diff --git a/reporter/otlp_reporter.go b/reporter/otlp_reporter.go index 1cf6201c..0a5163b6 100644 --- a/reporter/otlp_reporter.go +++ b/reporter/otlp_reporter.go @@ -606,7 +606,7 @@ func (r *OTLPReporter) getProfile() (profile *profiles.Profile, startTS, endTS u // semantic convention for build_id, replace these hard coded // strings. {key: "process.executable.build_id.gnu", value: execInfo.gnuBuildID}, - {key: "process.executable.build_id.profiling", + {key: "process.executable.build_id.htlhash", value: traceInfo.files[i].StringNoQuotes()}, }, attributeMap) @@ -660,8 +660,8 @@ func (r *OTLPReporter) getProfile() (profile *profiles.Profile, startTS, endTS u loc.Line = append(loc.Line, line) // To be compliant with the protocol, generate a dummy mapping entry. - loc.MappingIndex = getDummyMappingIndex(fileIDtoMapping, stringMap, - profile, traceInfo.files[i]) + loc.MappingIndex = getDummyMappingIndex(fileIDtoMapping, + stringMap, attributeMap, profile, traceInfo.files[i]) } profile.Location = append(profile.Location, loc) } @@ -785,24 +785,23 @@ func addProfileAttributes[T string | int64](profile *profiles.Profile, // getDummyMappingIndex inserts or looks up an entry for interpreted FileIDs. func getDummyMappingIndex(fileIDtoMapping map[libpf.FileID]uint64, - stringMap map[string]uint32, profile *profiles.Profile, - fileID libpf.FileID) uint64 { - var locationMappingIndex uint64 + stringMap map[string]uint32, attributeMap map[string]uint64, + profile *profiles.Profile, fileID libpf.FileID) uint64 { if tmpMappingIndex, exists := fileIDtoMapping[fileID]; exists { - locationMappingIndex = tmpMappingIndex - } else { - idx := uint64(len(fileIDtoMapping)) - fileIDtoMapping[fileID] = idx - locationMappingIndex = idx - - profile.Mapping = append(profile.Mapping, &profiles.Mapping{ - Filename: int64(getStringMapIndex(stringMap, "")), - BuildId: int64(getStringMapIndex(stringMap, - fileID.StringNoQuotes())), - BuildIdKind: *profiles.BuildIdKind_BUILD_ID_BINARY_HASH.Enum(), - }) + return tmpMappingIndex } - return locationMappingIndex + idx := uint64(len(fileIDtoMapping)) + fileIDtoMapping[fileID] = idx + + mappingAttributes := addProfileAttributes(profile, []attrKeyValue[string]{ + {key: "process.executable.build_id.htlhash", + value: fileID.StringNoQuotes()}}, attributeMap) + + profile.Mapping = append(profile.Mapping, &profiles.Mapping{ + Filename: int64(getStringMapIndex(stringMap, "")), + Attributes: mappingAttributes, + }) + return idx } // waitGrpcEndpoint waits until the gRPC connection is established.