Conversation
…passing in state to the instrumentation fields
bbakerman
commented
Feb 27, 2022
| public InstrumentationContext<ExecutionResult> beginField(InstrumentationFieldParameters parameters, InstrumentationState state) { | ||
| return new ChainedInstrumentationContext<>(map(instrumentations, it -> it.beginField(parameters, state))); | ||
| } | ||
|
|
Member
Author
There was a problem hiding this comment.
Note I still need to create a wrapper ChainedInstrumentationContext object per call
The alternative is
ImmutableList<InstrumentationContext<Object>> contexts = map(instrumentations, it -> it.beginFieldFetch(parameters, getState(it, state)));
return new InstrumentationContext<Object>() {
@Override
public void onDispatched(CompletableFuture<Object> result) {
contexts.forEach(ctx -> ctx.onDispatched(result));
}
@Override
public void onCompleted(Object result, Throwable t) {
contexts.forEach(ctx -> ctx.onCompleted(result,t));
}
};
and this is an object allocation anyway - since we MUST call back when the result is dispatched and most importantly when its finished
Member
Author
|
BTW this is failing some instrumentation tests because they assert that the tested methods have not been updated This needs t be fixed up if we went with these I think. I need to look more in to this |
Member
Author
|
Done in another PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to spike whether we can transition to passing "state" to each instrumentation method call rather than creating an object.
I think this works really well and is NON API breaking.
If we did this I think we would
getStateon the parameter objects