Skip to content

Commit 3aacd69

Browse files
committed
Update unsymbolized check logic & update label name
1 parent 93fd1b2 commit 3aacd69

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

pkg/experiment/block/metadata/metadata_labels.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import (
1616
// TODO(kolesnikovae): LabelBuilder pool.
1717

1818
const (
19-
LabelNameTenantDataset = "__tenant_dataset__"
20-
LabelValueDatasetTSDBIndex = "dataset_tsdb_index"
21-
LabelNameHasNativeUnsymbolizedProfiles = "__has_native_unsymbolized_profiles__"
19+
LabelNameTenantDataset = "__tenant_dataset__"
20+
LabelValueDatasetTSDBIndex = "dataset_tsdb_index"
21+
LabelNameUnsymbolized = "__unsymbolized__"
2222
)
2323

2424
type LabelBuilder struct {

pkg/experiment/ingester/memdb/head.go

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121
)
2222

2323
type FlushedHead struct {
24-
Index []byte
25-
Profiles []byte
26-
Symbols []byte
27-
HasNativeUnsymbolizedProfiles bool
28-
Meta struct {
24+
Index []byte
25+
Profiles []byte
26+
Symbols []byte
27+
HasUnsymbolizedProfiles bool
28+
Meta struct {
2929
ProfileTypeNames []string
3030
MinTimeNanos int64
3131
MaxTimeNanos int64
@@ -154,17 +154,7 @@ func (h *Head) flush(ctx context.Context) (*FlushedHead, error) {
154154
return res, nil
155155
}
156156

157-
var HasNativeUnsymbolizedProfiles bool
158-
mappings := h.symbols.Symbols().Mappings
159-
for i := range mappings {
160-
HasNativeUnsymbolizedProfiles = HasNativeUnsymbolizedProfiles || !mappings[i].HasFunctions
161-
}
162-
locations := h.symbols.Symbols().Locations
163-
for i := range locations {
164-
HasNativeUnsymbolizedProfiles = HasNativeUnsymbolizedProfiles || len(locations[i].Line) == 0
165-
}
166-
167-
res.HasNativeUnsymbolizedProfiles = HasNativeUnsymbolizedProfiles
157+
res.HasUnsymbolizedProfiles = HasUnsymbolizedProfiles(h.symbols.Symbols())
168158

169159
symbolsBuffer := bytes.NewBuffer(nil)
170160
if err := symdb.WritePartition(h.symbols, symbolsBuffer); err != nil {
@@ -186,3 +176,16 @@ func (h *Head) flush(ctx context.Context) (*FlushedHead, error) {
186176
}
187177
return res, nil
188178
}
179+
180+
// TODO: move this into the symbolizer package when available
181+
func HasUnsymbolizedProfiles(symbols *symdb.Symbols) bool {
182+
locations := symbols.Locations
183+
mappings := symbols.Mappings
184+
for _, loc := range locations {
185+
if loc.MappingId == 0 || int(loc.MappingId) >= len(mappings) ||
186+
!mappings[loc.MappingId].HasFunctions {
187+
return true
188+
}
189+
}
190+
return false
191+
}

pkg/experiment/ingester/segment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ func concatSegmentHead(f *headFlush, w *writerOffset, s *metadata.StringTable) *
332332
lb.WithLabelSet(model.LabelNameServiceName, f.head.key.service, model.LabelNameProfileType, profileType)
333333
}
334334

335-
if f.flushed.HasNativeUnsymbolizedProfiles {
336-
lb.WithLabelSet(model.LabelNameServiceName, f.head.key.service, metadata.LabelNameHasNativeUnsymbolizedProfiles, "true")
335+
if f.flushed.HasUnsymbolizedProfiles {
336+
lb.WithLabelSet(model.LabelNameServiceName, f.head.key.service, metadata.LabelNameUnsymbolized, "true")
337337
}
338338

339339
// Other optional labels:

0 commit comments

Comments
 (0)