-
Notifications
You must be signed in to change notification settings - Fork 1k
Added option to set a parent Observation on an existing Observation #3291
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
Conversation
without this change in order to e.g. create spans we always need to put an observation in scope so that spans are put in thread local and a child span is being set. That doesn't make a lot of sense when we exactly know what the parent observation is. with this change we're allowing to set a parent observation direcly on an existing observation. That way we're able to maintain a parent child relationship of observations and of e.g. spans
without this change in order to e.g. create spans we always need to put an observation in scope so that spans are put in thread local and a child span is being set. That doesn't make a lot of sense when we exactly know what the parent observation is. with this change we're allowing to set a parent observation direcly on an existing observation. That way we're able to maintain a parent child relationship of observations and of e.g. spans related to micrometer-metrics/micrometer#3291
|
||
@Override | ||
@Nullable | ||
public <T> T get(Object key) { |
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.
TypeParameterUnusedInFormals: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.
Reply with "@sonatype-lift help" for info about LiftBot commands.
Reply with "@sonatype-lift ignore" to tell LiftBot to leave out the above finding from this PR.
Reply with "@sonatype-lift ignoreall" to tell LiftBot to leave out all the findings from this PR and from the status bar in Github.
When talking to LiftBot, you need to refresh the page to see its response. Click here to get to know more about LiftBot commands.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
|
||
@Override | ||
@NonNull | ||
public <T> T getRequired(Object key) { |
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.
TypeParameterUnusedInFormals: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.
Reply with "@sonatype-lift help" for info about LiftBot commands.
Reply with "@sonatype-lift ignore" to tell LiftBot to leave out the above finding from this PR.
Reply with "@sonatype-lift ignoreall" to tell LiftBot to leave out all the findings from this PR and from the status bar in Github.
When talking to LiftBot, you need to refresh the page to see its response. Click here to get to know more about LiftBot commands.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
* @return entry ot exception if not present | ||
*/ | ||
@NonNull | ||
<T> T getRequired(Object key); |
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.
TypeParameterUnusedInFormals: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.
Reply with "@sonatype-lift help" for info about LiftBot commands.
Reply with "@sonatype-lift ignore" to tell LiftBot to leave out the above finding from this PR.
Reply with "@sonatype-lift ignoreall" to tell LiftBot to leave out all the findings from this PR and from the status bar in Github.
When talking to LiftBot, you need to refresh the page to see its response. Click here to get to know more about LiftBot commands.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
* @return entry or {@code null} if not present | ||
*/ | ||
@Nullable | ||
<T> T get(Object key); |
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.
TypeParameterUnusedInFormals: Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.
Reply with "@sonatype-lift help" for info about LiftBot commands.
Reply with "@sonatype-lift ignore" to tell LiftBot to leave out the above finding from this PR.
Reply with "@sonatype-lift ignoreall" to tell LiftBot to leave out all the findings from this PR and from the status bar in Github.
When talking to LiftBot, you need to refresh the page to see its response. Click here to get to know more about LiftBot commands.
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
@@ -228,6 +228,13 @@ static Observation createNotStarted(ObservationConvention<?> observationConventi | |||
*/ | |||
Observation contextualName(String contextualName); | |||
|
|||
/** | |||
* Sets the parent {@link Observation}. |
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.
It would be good for us to explain here why a user would want to do this (avoid needing to scope) and that it isn't needed if you are creating a scope.
|
||
} | ||
|
||
static class ImmutableContext extends Context { |
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.
This isn't used anywhere.
) * Added option to set a parent Observation on an existing Observation without this change in order to e.g. create spans we always need to put an observation in scope so that spans are put in thread local and a child span is being set. That doesn't make a lot of sense when we exactly know what the parent observation is. with this change we're allowing to set a parent observation direcly on an existing observation. That way we're able to maintain a parent child relationship of observations and of e.g. spans related to micrometer-metrics/micrometer#3291 * Fixed the http observation handlers
without this change in order to e.g. create spans we always need to put an observation in scope so that spans are put in thread local and a child span is being set. That doesn't make a lot of sense when we exactly know what the parent observation is.
with this change we're allowing to set a parent observation direcly on an existing observation. That way we're able to maintain a parent child relationship of observations and of e.g. spans