automatic instrumentation does not override manual results#752
automatic instrumentation does not override manual results#752felixbarny merged 2 commits intoelastic:masterfrom wolframhaussig:http-do-not-override-result
Conversation
… set using the API with Transaction.setResult removed check from Quartz which did the same thing
eyalkoren
left a comment
There was a problem hiding this comment.
@wolframhaussig Thanks for the PR!
Since our auto instrumentation would normally set the result as the last thing before ending the transaction, I wonder if it would be good enough to change the implementation of Transaction#withResult to set the result field only if it is still null.
Since our injected code must run after the application code (which includes the manual API usage) - this should be safe enough.
|
@eyalkoren I guess I thought too compliated here 😄 I thought that as you have already a ticket for priority of transaction names that there might be the usecase to have the priority here too... I will change the code as suggested |
|
@wolframhaussig you are absolutely right, there can definitely be a case for that in the future, but your implementation basically allows two priorities (user-defined or other), so I think it might as well be done with a null check. If we encounter a situation where we need multiple priorities for the result in the future- we can add it then. |
|
@eyalkoren I have found a code piece where we might change the result - can you have a look at that and tell me your opinion? In the opentracing implemenation there is this method. |
|
@wolframhaussig yes, you are right, in this case you could assign higher priority to the |
That could be fixed by checking if the result has already been set in the instrumentation.
Good catch. We could have two methods like
|
|
run the tests |
This PR changes the logic of the result so results set via the API takes precedence. Until now, a result set via the API would be overridden by the automatic instrumentation(for example on a HTTP call).
I have removed the check in the quartz plugin which I have added while writing it because it did the same thing.
Checklist