-
Notifications
You must be signed in to change notification settings - Fork 155
Add option to start new root span with link to remote context #406
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
base: main
Are you sure you want to change the base?
Conversation
76305b2 to
e12e7ba
Compare
|
@soluchok - I see this PR is marked as draft - is it still being worked on? The docs can be generated by running |
df727ef to
373d5d7
Compare
373d5d7 to
cd85cc5
Compare
|
Hey @soluchok 👋 Will give this a look a bit later today. Apologies for the delay. |
gregfurman
left a comment
There was a problem hiding this 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), |
There was a problem hiding this comment.
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(). |
There was a problem hiding this comment.
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.
| newSpan, err := p.FieldBool(nrswlField) | ||
| if err != nil && !strings.Contains(err.Error(), "was not found in the config") { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
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
| 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
bento/internal/httpclient/auth_oauth2.go
Lines 115 to 117 in f56fc96
| if !conf.Contains(aFieldOAuth2) { | |
| return | |
| } |
and (probably incorrectly formatted) suggestion 👇
| 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 | |
| } | |
| } |
|
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! |
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.