Skip to content

Commit

Permalink
fix after rebase
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Jan 8, 2025
1 parent ab98a7d commit 405dbca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 5 additions & 6 deletions pkg/ottl/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,12 @@ func Test_e2e_editors(t *testing.T) {
m.PutStr("test.conflict.conflict1.conflict2", "pass")
m.PutStr("test.conflict.conflict1.conflict2.0", "nopass")

m1 := m.PutEmptyMap("test.things")
m1.PutStr("name", "foo")
m1.PutInt("value", 2)
m.PutStr("test.things.0.name", "foo")
m.PutInt("test.things.0.value", 2)

m.PutStr("test.things.1.name", "bar")
m.PutInt("test.things.1.value", 5)

m2 := m.PutEmptyMap("test.things.0")
m2.PutStr("name", "bar")
m2.PutInt("value", 5)
m.CopyTo(tCtx.GetLogRecord().Attributes())
},
},
Expand Down
7 changes: 6 additions & 1 deletion pkg/ottl/ottlfuncs/func_flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ func flattenValue(k string, v pcommon.Value, currentDepth int64, maxDepth int64,
case v.Slice().At(i).Type() == pcommon.ValueTypeSlice && currentDepth+1 < maxDepth:
flattenSlice(v.Slice().At(i).Slice(), result, fmt.Sprintf("%v.%v", prefix+k, i), currentDepth+2, maxDepth, conflict, existingKeys)
default:
v.Slice().At(i).CopyTo(result.PutEmpty(fmt.Sprintf("%v.%v", prefix+k, i)))
key := prefix + k
if conflict {
handleConflict(existingKeys, key, v.Slice().At(i), &result)
} else {
v.Slice().At(i).CopyTo(result.PutEmpty(fmt.Sprintf("%v.%v", key, i)))
}
}
}
default:
Expand Down

0 comments on commit 405dbca

Please sign in to comment.