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

Infer destination service resource adapt public api #1003

Conversation

stuartnelson3
Copy link
Contributor

  • Add support for exit spans, auto-infer their destination.service.resource
  • Remove destination.service.{name,type} from the public api and mark them as deprecated

closes #976

@stuartnelson3 stuartnelson3 requested a review from a team August 11, 2021 15:40
@apmmachine
Copy link
Contributor

apmmachine commented Aug 11, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-08-16T07:14:18.450+0000

  • Duration: 30 min 21 sec

  • Commit: ee8cb43

Test stats 🧪

Test Results
Failed 0
Passed 10881
Skipped 268
Total 11149

Trends 🧪

Image of Build Times

Image of Tests

spancontext.go Outdated Show resolved Hide resolved
spancontext.go Show resolved Hide resolved
validation_test.go Outdated Show resolved Hide resolved
gocontext.go Outdated Show resolved Hide resolved
model/model.go Outdated Show resolved Hide resolved
span.go Outdated Show resolved Hide resolved
span.go Outdated Show resolved Hide resolved
span.go Outdated Show resolved Hide resolved
tests are passing, but it'd be nice to not have
this complicated dance.
span.go Outdated
Comment on lines 90 to 92
if opts.parent != nil {
opts.parent.mu.Unlock()
}
Copy link
Member

@axw axw Aug 12, 2021

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.

Copy link
Contributor Author

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.

Copy link
Member

@axw axw left a 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) {
Copy link
Member

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.

Copy link
Member

@axw axw left a 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() {
Copy link
Member

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?

@stuartnelson3 stuartnelson3 merged commit ea77433 into elastic:master Aug 16, 2021
@stuartnelson3 stuartnelson3 deleted the infer-destination-service-resource-adapt-public-api branch August 16, 2021 09:04
@axw axw mentioned this pull request Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[META 448] Auto-infer destination.service.resource and adapt public API
3 participants