Skip to content

Commit 8cc22ed

Browse files
fix: OTLP: Guard against profiles with no lines (#4517)
* Guard against profiles with no lines * Updated test data
1 parent db7b86a commit 8cc22ed

File tree

2 files changed

+1118
-39
lines changed

2 files changed

+1118
-39
lines changed

pkg/ingester/otlp/convert.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,19 @@ func (p *profileBuilder) convertMappingBack(ols []*otelProfile.Location, om *ote
442442
the mapping is marked as not having that information.
443443
*/
444444
for _, ol := range ols {
445+
// If at least one location belonging to mapping does not have lines, we must flag whole mapping as not having symbol info.
446+
if len(ol.Line) == 0 {
447+
hasLines = false
448+
hasFunctions = false
449+
hasInlineFrames = false
450+
hasFilenames = false
451+
}
452+
453+
// If by this point we know that mapping has no symbol info, we can stop checking other locations.
454+
if !hasLines && !hasFunctions && !hasInlineFrames && !hasFilenames {
455+
break
456+
}
457+
445458
for i, line := range ol.Line {
446459
hasFunctions = hasFunctions && line.FunctionIndex > 0
447460
hasLines = hasLines && line.Line > 0

0 commit comments

Comments
 (0)