-
Notifications
You must be signed in to change notification settings - Fork 962
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
Make Context.getParentObservation() available for ObservationPredicate #3867
Conversation
Thank you for the PR! Let us discuss this internally, I think this could resolve #3678 also we might want to add something like a |
Should I add |
Would it be merged in next release? |
I think it like a bug more than a enhancement, please fix it ASAP. |
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.
The changes seem reasonable to me. One minor concern is that moving this out of the constructor means that we need to always make sure to set the parent wherever we might create an Observation. Even if this pull request covers all the places now, it's something that could be missed in future changes. I'm not sure we can do anything about that and allow the behavior we're seeking to change.
I'm asking others on the team to review so we can get feedback on this change in snapshots and a future milestone if we are going to merge this.
After this commit, Context.setParentObservation() is called before matching predicate.
We could revert |
The team discussed and we're okay to merge now and get some feedback and testing from users of this code. There are several consumers of this code that we'll want to get feedback on post-merge. I've built this locally and ran the tracing build against it - the build passed. Some instrumentation may be able to get rid of some code thanks to this change if they are manually setting a parent on the context before creating an Observation. Thank you @quaff for the pull request.
Thanks for thinking about this. That idea did occur to me, but I think if we're hitting that code path, we're going to have a difference in behavior between that path and other paths that we probably don't want. |
@shakuzen Thanks for your quick response, I've updated the commit to eliminate unnecessary null check |
I didn't notice that. We should not have changed that in this pull request. It's not good that we didn't have tests that failed because of the change. The context supplier comes from users, so we can't know that it doesn't return null, and we have no way of marking nullability of what the supplier returns. While |
Any estimate on which release this will be included in? |
@Nirshal If you look at the right side of the UI in the If you are asking about the GA release date that should be in November (I guess 13th). You can also check: https://calendar.spring.io/ |
@jonatan-ivanov thanks a lot for the explanation! |
After this commit, Context.setParentObservation() is called before matching predicate.
now we can filter out parentless observations like this:
Resolves #3678