Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Root spans must have a non-empty parent ID field #1236

Merged
merged 2 commits into from
Jul 18, 2024
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
2 changes: 1 addition & 1 deletion collect/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ func (i *InMemCollector) isRootSpan(sp *types.Span) bool {
// check if the event has a parent id using the configured parent id field names
for _, parentIdFieldName := range i.Config.GetParentIdFieldNames() {
parentId := sp.Data[parentIdFieldName]
if _, ok := parentId.(string); ok {
if _, ok := parentId.(string); ok && parentId != "" {
return false
}
}
Expand Down
4 changes: 2 additions & 2 deletions collect/collect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1384,15 +1384,15 @@ func TestIsRootSpan(t *testing.T) {
expected: true,
},
{
name: "non-root span - empty parent id",
name: "root span - empty parent id",
span: &types.Span{
Event: types.Event{
Data: map[string]interface{}{
"trace.parent_id": "",
},
},
},
expected: false,
expected: true,
},
{
name: "non-root span - parent id",
Expand Down
Loading