Skip to content
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
* [BUGFIX] Fix unsupported nonexistence nil operator for tags lookup. Fixed issue where some tag values/names were not returned due to distinctAttrCollector optimization [#5967](https://github.com/grafana/tempo/pull/5967) (@ie-pham) (@joe-elliott)
* [BUGFIX] Fix delete implementation for s3/gcs/azure backends to account for prefix. [#6011](https://github.com/grafana/tempo/pull/6011) (@kaustubhkurve)
* [BUGFIX] Fix issue with orphaned group nodes in vParquet5-preview6 [#6095](https://github.com/grafana/tempo/pull/6095) (@stoewer)
* [BUGFIX] Fix disappearing dedicated event attrs in trace view and dedicated blob column validation in vParquet5-preview6 [#6100](https://github.com/grafana/tempo/pull/6100) (@stoewer)

# v2.9.0

Expand Down
20 changes: 19 additions & 1 deletion pkg/util/test/req.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@
{Scope: "span", Name: "dedicated.span.6", Type: "int"},
{Scope: "span", Name: "dedicated.span.7", Type: "int"},
}
dedicatedColumnsEvent = backend.DedicatedColumns{
{Scope: "event", Name: "dedicated.event.1", Type: "string"},
{Scope: "event", Name: "dedicated.event.2", Type: "string"},
}
)

// AddDedicatedAttributes adds resource and span attributes to a trace that are stored in dedicated
Expand Down Expand Up @@ -286,6 +290,13 @@
Value: makeVal(c.Type, c.Scope, i),
})
}
eventAttrs := make([]*v1_common.KeyValue, 0, len(dedicatedColumnsEvent))
for i, c := range dedicatedColumnsEvent {
eventAttrs = append(eventAttrs, &v1_common.KeyValue{
Key: c.Name,
Value: makeVal(c.Type, c.Scope, i),
})
}

Check notice on line 299 in pkg/util/test/req.go

View workflow job for this annotation

GitHub Actions / Coverage Annotations

Uncovered lines

Lines 293-299 are not covered by tests

for _, batch := range trace.ResourceSpans {
attr := make([]*v1_common.KeyValue, 0, len(resourceAttrs)+len(batch.Resource.Attributes))
Expand All @@ -297,6 +308,12 @@
attr = make([]*v1_common.KeyValue, 0, len(spanAttrs)+len(span.Attributes))
attr = append(attr, spanAttrs...)
span.Attributes = append(attr, span.Attributes...)

for _, e := range span.Events {
attr = make([]*v1_common.KeyValue, 0, len(eventAttrs)+len(e.Attributes))
attr = append(attr, eventAttrs...)
e.Attributes = append(attr, e.Attributes...)
}

Check notice on line 316 in pkg/util/test/req.go

View workflow job for this annotation

GitHub Actions / Coverage Annotations

Uncovered lines

Lines 311-316 are not covered by tests
}
}
}
Expand All @@ -323,9 +340,10 @@
// MakeDedicatedColumns creates a dedicated column assignment that matches the attributes
// generated by AddDedicatedAttributes.
func MakeDedicatedColumns() backend.DedicatedColumns {
columns := make(backend.DedicatedColumns, 0, len(dedicatedColumnsResource)+len(dedicatedColumnsSpan))
columns := make(backend.DedicatedColumns, 0, len(dedicatedColumnsResource)+len(dedicatedColumnsSpan)+len(dedicatedColumnsEvent))

Check notice on line 343 in pkg/util/test/req.go

View workflow job for this annotation

GitHub Actions / Coverage Annotations

Uncovered line

Line 343 is not covered by tests
columns = append(columns, dedicatedColumnsResource...)
columns = append(columns, dedicatedColumnsSpan...)
columns = append(columns, dedicatedColumnsEvent...)

Check notice on line 346 in pkg/util/test/req.go

View workflow job for this annotation

GitHub Actions / Coverage Annotations

Uncovered line

Line 346 is not covered by tests
return columns
}

Expand Down
2 changes: 1 addition & 1 deletion tempodb/backend/block_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (dcs DedicatedColumns) Validate() error {
}

for _, opt := range dc.Options {
if opt != DedicatedColumnOptionArray {
if opt != DedicatedColumnOptionArray && opt != DedicatedColumnOptionBlob {
return fmt.Errorf("invalid dedicated attribute columns: invalid option '%s'", opt)
}
}
Expand Down
16 changes: 15 additions & 1 deletion tempodb/backend/block_meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,26 @@ func TestDedicatedColumns_Validate(t *testing.T) {
isValid: true,
},
{
name: "valid with options",
name: "array option",
cols: DedicatedColumns{
{Name: "test.span.str", Scope: DedicatedColumnScopeSpan, Type: DedicatedColumnTypeString, Options: DedicatedColumnOptions{DedicatedColumnOptionArray}},
},
isValid: true,
},
{
name: "blob option",
cols: DedicatedColumns{
{Name: "test.span.str", Scope: DedicatedColumnScopeSpan, Type: DedicatedColumnTypeString, Options: DedicatedColumnOptions{DedicatedColumnOptionBlob}},
},
isValid: true,
},
{
name: "all options",
cols: DedicatedColumns{
{Name: "test.span.str", Scope: DedicatedColumnScopeSpan, Type: DedicatedColumnTypeString, Options: DedicatedColumnOptions{DedicatedColumnOptionArray, DedicatedColumnOptionBlob}},
},
isValid: true,
},
{
name: "all valid scopes and types",
cols: DedicatedColumns{
Expand Down
4 changes: 4 additions & 0 deletions tempodb/encoding/vparquet5/block_traceql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,10 @@ func fullyPopulatedTestTraceWithOption(id common.ID, parentIDTest bool) *Trace {
attr("event-attr-key-2", "event-value-2"),
attr("message", "exception"),
},
DedicatedAttributes: DedicatedAttributes{
String01: []string{"dedicated-event-attr-value-1"},
String02: []string{"dedicated-event-attr-value-2"},
},
},
},
Links: links,
Expand Down
18 changes: 14 additions & 4 deletions tempodb/encoding/vparquet5/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ func parquetToProtoLinks(parquetLinks []Link) []*v1_trace.Span_Link {
return protoLinks
}

func parquetToProtoEvents(parquetEvents []Event, spanStartTimeNano uint64) []*v1_trace.Span_Event {
func parquetToProtoEvents(parquetEvents []Event, spanStartTimeNano uint64, dedicatedAttributes dedicatedColumnMapping) []*v1_trace.Span_Event {
var protoEvents []*v1_trace.Span_Event

if len(parquetEvents) > 0 {
Expand All @@ -735,6 +735,16 @@ func parquetToProtoEvents(parquetEvents []Event, spanStartTimeNano uint64) []*v1
protoEvent.Attributes = parquetToProtoAttrs(e.Attrs)
}

for attr, col := range dedicatedAttributes.items() {
val := col.readValue(&e.DedicatedAttributes)
if val != nil {
protoEvent.Attributes = append(protoEvent.Attributes, &v1.KeyValue{
Key: attr,
Value: val,
})
}
}

protoEvents = append(protoEvents, protoEvent)
}
}
Expand All @@ -749,6 +759,7 @@ func ParquetTraceToTempopbTrace(meta *backend.BlockMeta, parquetTrace *Trace) *t
// dedicated attribute column assignments
dedicatedResourceAttributes := dedicatedColumnsToColumnMapping(meta.DedicatedColumns, backend.DedicatedColumnScopeResource)
dedicatedSpanAttributes := dedicatedColumnsToColumnMapping(meta.DedicatedColumns, backend.DedicatedColumnScopeSpan)
dedicatedEventAttributes := dedicatedColumnsToColumnMapping(meta.DedicatedColumns, backend.DedicatedColumnScopeEvent)

for _, rs := range parquetTrace.ResourceSpans {
protoBatch := &v1_trace.ResourceSpans{}
Expand Down Expand Up @@ -807,13 +818,12 @@ func ParquetTraceToTempopbTrace(meta *backend.BlockMeta, parquetTrace *Trace) *t
},
Attributes: spanAttr,
DroppedAttributesCount: uint32(span.DroppedAttributesCount),
Events: parquetToProtoEvents(span.Events, span.StartTimeUnixNano),
Events: parquetToProtoEvents(span.Events, span.StartTimeUnixNano, dedicatedEventAttributes),
DroppedEventsCount: uint32(span.DroppedEventsCount),
Links: parquetToProtoLinks(span.Links),
DroppedLinksCount: uint32(span.DroppedLinksCount),
}

protoSpan.Links = parquetToProtoLinks(span.Links)

// dynamically assigned dedicated resource attribute columns
for attr, col := range dedicatedSpanAttributes.items() {
val := col.readValue(&span.DedicatedAttributes)
Expand Down
6 changes: 6 additions & 0 deletions tempodb/encoding/vparquet5/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ func TestTraceToParquet(t *testing.T) {
Name: "event name",
Attributes: []*v1.KeyValue{
{Key: "event.attr", Value: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: "bbb"}}},
{Key: "dedicated.event.1", Value: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: "dedicated-event-attr-value-1"}}},
{Key: "dedicated.event.2", Value: &v1.AnyValue{Value: &v1.AnyValue_StringValue{StringValue: "dedicated-event-attr-value-2"}}},
},
}},
},
Expand Down Expand Up @@ -723,6 +725,10 @@ func TestTraceToParquet(t *testing.T) {
Attrs: []Attribute{
attr("event.attr", "bbb"),
},
DedicatedAttributes: DedicatedAttributes{
String01: []string{"dedicated-event-attr-value-1"},
String02: []string{"dedicated-event-attr-value-2"},
},
}},
},
},
Expand Down
Loading