Skip to content

Conversation

@soluchok
Copy link

@soluchok soluchok commented Jul 20, 2025

The problem: When we have hundreds of streams reading from the same NATS topic, traces in Jaeger are tied to a single root span.

The solution: This PR introduces a new option, new_root_span_with_link, which creates a new root span while preserving a link to the original span.

@soluchok soluchok force-pushed the new_root_span_with_link branch 4 times, most recently from 76305b2 to e12e7ba Compare July 20, 2025 18:03
@soluchok soluchok marked this pull request as draft July 25, 2025 19:01
@jem-davies
Copy link
Collaborator

@soluchok - I see this PR is marked as draft - is it still being worked on?

The docs can be generated by running make docs - it is mentioned on the CONTRIBUTING.md file

@soluchok soluchok force-pushed the new_root_span_with_link branch 2 times, most recently from df727ef to 373d5d7 Compare September 17, 2025 10:17
@soluchok soluchok force-pushed the new_root_span_with_link branch from 373d5d7 to cd85cc5 Compare September 17, 2025 11:21
@soluchok soluchok marked this pull request as ready for review September 17, 2025 11:29
@gregfurman
Copy link
Collaborator

Hey @soluchok 👋 Will give this a look a bit later today. Apologies for the delay.

Copy link
Collaborator

@gregfurman gregfurman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🤩 Thanks for the super neat addition!!

If possible, would love if we could add a test. Happy to do in a follow-up, or I can just push to your branch, given how long it's taken us to review this (we squash commits so PR will be solely authored to you).

return service.NewExtractTracingSpanMappingField().Version(tracingVersion)
func inputTracingDocs() []*service.ConfigField {
return []*service.ConfigField{
service.NewExtractTracingSpanMappingField().Version(tracingVersion),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change tracingVersion here to v1.0.0 and your addition to v1.13.0 (the upcoming release)? Seems the tracingVersion is still referencing a pre-fork version that isn't relevant here 😃

return NewBoolField(nrswlField).
Description("EXPERIMENTAL: Starts a new root span with link to parent.").
Version("1.0.0").
Optional().
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Let's add a Default of false here to allow no value being set to pass config validations.

Comment on lines +53 to +56
newSpan, err := p.FieldBool(nrswlField)
if err != nil && !strings.Contains(err.Error(), "was not found in the config") {
return nil, err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a bool field, if we error out here you could just ignore the error since it'll default to false i.e

Suggested change
newSpan, err := p.FieldBool(nrswlField)
if err != nil && !strings.Contains(err.Error(), "was not found in the config") {
return nil, err
}
newSpan, _ := p.FieldBool(nrswlField)
if err != nil {
return nil, err
}

Properly configuring the config to have a default means this check would probably fall away. Else, since this is optional, we can add a p.Contains(nrswlField) and only do this check if the field exists in the parsed config

see example

if !conf.Contains(aFieldOAuth2) {
return
}

and (probably incorrectly formatted) suggestion 👇

Suggested change
newSpan, err := p.FieldBool(nrswlField)
if err != nil && !strings.Contains(err.Error(), "was not found in the config") {
return nil, err
}
var newSpan bool
if p.Contains(nrswlField) {
if err != nil {
return nil, err
}
}

@gregfurman
Copy link
Collaborator

Hey @soluchok 👋 Do you no longer have have capacity to address my review? I opened a PR in your fork since I don't have permissions to push to your feature branch directly.

Otherwise, I'm happy to close this PR, cherry-pick your commit, and open another with the new changes included. Lmk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants