Fix mixing capturing and non-capturing log probes#4649
Conversation
Creates a copy of the current snapshot and depending of the probe definition indicates capturing or not, includes the captured data (`Captures` object)
| duration, | ||
| stack, | ||
| captures, | ||
| additionalProbe.captureSnapshot ? captures : new Captures(), |
There was a problem hiding this comment.
suggest to change this variable name to "newProbe" or "forProbe".
while it was additional Probe before, now it the current probe for the copied version of the probe.
maybe also change the name of the function duplicateSnapshotForProbe
Do we need the second argument? as we always just generate a random UUID for duplicated snapshot
| @@ -222,10 +220,8 @@ public void commit() { | |||
| if (status.hasErrors) { | |||
There was a problem hiding this comment.
I'm not sure we need this now as it also happen on the copy function. line no. 243
So we might just remove this?
| "snapshot":\{ | ||
| "captures":\{\}, | ||
| "evaluationErrors":\[\{"expr":"obj.field","message":"Cannot dereference obj"\}\], | ||
| "id":"[^"]+", |
There was a problem hiding this comment.
not sure why we don't have an ID as the snapshot copy always add id.
There was a problem hiding this comment.
because of the way we unit test this. we are not using a sink for that, so no id generated.
There was a problem hiding this comment.
actually I have changed the unit test to really use the sink, and adapted the regex
fix unit test rename
What Does This Do
Creates a copy of the current snapshot and depending of the probe definition indicates capturing or not, includes the captured data (
Capturesobject)Motivation
When creating 2 log probes on the same method (duplicated), one is capturing the other not, snapshots with captured data included are sent in both cases.
Additional Notes