Skip to content

Fix mixing capturing and non-capturing log probes#4649

Merged
jpbempel merged 2 commits into
masterfrom
jpbempel/fix-dup-mix-capture
Feb 6, 2023
Merged

Fix mixing capturing and non-capturing log probes#4649
jpbempel merged 2 commits into
masterfrom
jpbempel/fix-dup-mix-capture

Conversation

@jpbempel

@jpbempel jpbempel commented Feb 3, 2023

Copy link
Copy Markdown
Member

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 (Captures object)

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

Creates a copy of the current snapshot and depending of the probe
definition indicates capturing or not, includes the captured data
(`Captures` object)
@jpbempel
jpbempel requested a review from a team as a code owner February 3, 2023 13:41
@jpbempel
jpbempel requested review from shatzi and removed request for a team February 3, 2023 13:41

@shatzi shatzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

duration,
stack,
captures,
additionalProbe.captureSnapshot ? captures : new Captures(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -222,10 +220,8 @@ public void commit() {
if (status.hasErrors) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, thanks

"snapshot":\{
"captures":\{\},
"evaluationErrors":\[\{"expr":"obj.field","message":"Cannot dereference obj"\}\],
"id":"[^"]+",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we don't have an ID as the snapshot copy always add id.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of the way we unit test this. we are not using a sink for that, so no id generated.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I have changed the unit test to really use the sink, and adapted the regex

@jpbempel jpbempel added the comp: debugger Dynamic Instrumentation label Feb 6, 2023
fix unit test
rename
@jpbempel
jpbempel merged commit 57aaab5 into master Feb 6, 2023
@jpbempel
jpbempel deleted the jpbempel/fix-dup-mix-capture branch February 6, 2023 18:50
@github-actions github-actions Bot added this to the 1.7.0 milestone Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: debugger Dynamic Instrumentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants