-
Notifications
You must be signed in to change notification settings - Fork 197
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
Infer destination service resource adapt public api #1003
Infer destination service resource adapt public api #1003
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
SpanData is removed when span is ended, but we may want to tell if a span was an exit span after it's been ended.
tests are passing, but it'd be nice to not have this complicated dance.
span.go
Outdated
if opts.parent != nil { | ||
opts.parent.mu.Unlock() | ||
} |
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.
Moving the unlock away from the lock scares me a bit. TBH I'm really not a fan of this implicit exit span status, so I've raised the question with agent devs whether it is necessary to implement that part of the spec.
EDIT: point being that if we don't need to do the implicit check, and we only have explicitly identified exit spans, then "s.exit" is immutable from span start and requires no locking.
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.
👍 makes sense. I'm not a fan of this locking either, so let's see what happens.
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.
Thanks, this is looking much better now. Just one issue now about timing of the implicit SetDestinationService call, and the values used.
span.go
Outdated
@@ -384,6 +398,25 @@ func (s *Span) ended() bool { | |||
return s.SpanData == nil | |||
} | |||
|
|||
func (s *Span) setExitSpan(name, spanType string) { |
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.
Looking at the spec, I believe the resource is meant to be set to subtype || type
.
Subtype and Type can be set after starting a span, so I think we need to do that when ending the span. What we can do is keep track of whether SpanContext.SetDestinationService has been called (even with empty strings), and if it is never called for an exit span, then do this implicit call when ending the exit span.
If the user does not set a value by the time the span is ended, infer the value from the span data
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.
thanks, looks great :)
span.go
Outdated
@@ -384,6 +403,24 @@ func (s *Span) ended() bool { | |||
return s.SpanData == nil | |||
} | |||
|
|||
func (s *Span) setExitSpan() { |
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.
setExitSpanDestinationService
might be a bit clearer on the intent?
destination.service.resource
destination.service.{name,type}
from the public api and mark them as deprecatedcloses #976