Skip to content
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

Add evaluateAt support for probe instrumentations #4320

Merged
merged 3 commits into from
Nov 29, 2022

Conversation

jpbempel
Copy link
Member

What Does This Do

  • Snapshot: indicates for method probe where conditions are evaluated before serializing data. Either at entry or exit of the method.
  • Metric: indicates for method probe where the metric is emitted and with which values. For example at Exit of the method you can emit the return value of the method.
  • Log: use the same mechanism than snapshot but can report for example at exit of the method the return value.

Motivation

following #4313

Additional Notes

@jpbempel jpbempel requested a review from a team as a code owner November 25, 2022 16:47
@jpbempel jpbempel requested review from cimi, a team and ojung and removed request for a team and cimi November 25, 2022 16:47
@jpbempel jpbempel force-pushed the jpbempel/evaluate-at-usage branch from 92e7a17 to 281f012 Compare November 25, 2022 21:08
case EXIT:
return Snapshot.MethodLocation.EXIT;
}
return null;
Copy link
Member

Choose a reason for hiding this comment

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

Will this become a NPE in the caller?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmmm no, why?


protected LabelNode getReturnHandler(AbstractInsnNode exitNode) {
// exit node must have been removed from the original instruction list
assert exitNode.getNext() == null && exitNode.getPrevious() == null;
Copy link
Member

Choose a reason for hiding this comment

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

Assertions aren't enabled by default, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, only if you enable with -ea

Copy link
Member

Choose a reason for hiding this comment

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

Soo, this is redundant because nobody enables assertions?

Copy link
Member Author

Choose a reason for hiding this comment

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

removing...

Copy link
Member

Choose a reason for hiding this comment

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

How about replacing with a IllegalArgumentException?

Copy link
Contributor

@shatzi shatzi left a comment

Choose a reason for hiding this comment

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

looks good. some questions regarding metrics

}
}

@Override
protected InsnList getBeforeReturnInsnList(AbstractInsnNode node) {
return callMetric(metricProbe);
Copy link
Contributor

Choose a reason for hiding this comment

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

will this callMetric would have access to @return and @duration?

Copy link
Contributor

Choose a reason for hiding this comment

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

would we be able to add condition for metrics in this fashion as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

will this callMetric would have access to @return and @duration?

Nope, they are not introduced in this context, yet

would we be able to add condition for metrics in this fashion as well?

yes it's possible, need some work, though

@@ -290,6 +295,12 @@ public enum Kind {
AFTER;
}

public enum MethodLocation {
NONE,
Copy link
Contributor

Choose a reason for hiding this comment

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

I find the name and value confusing.

evalautAt = None means evaluate both at entry and exit for snapshot but entry for metric and logs (I think). maybe change it to DEFAULT or use null to indicate there is nothing there.

Also suggest to rename to EvalauteAtLocation not confusing with method inside ProbleLocation.

 * Snapshot: indicates for method probe where conditions are evaluated
before serializing data. Either at entry or exit of the method.
 * Metric: indicates for method probe where the metric is emitted and
with which values. For example at Exit of the method you can emit
the return value of the method.
 * Log: use the same mechanism than snapshot but can report for
example at exit of the method the return value.
@jpbempel jpbempel force-pushed the jpbempel/evaluate-at-usage branch from 53f4bc4 to 3e0b9c9 Compare November 28, 2022 22:24
@jpbempel jpbempel force-pushed the jpbempel/evaluate-at-usage branch from 3e0b9c9 to b184e07 Compare November 28, 2022 22:50
@jpbempel jpbempel merged commit b904407 into master Nov 29, 2022
@jpbempel jpbempel deleted the jpbempel/evaluate-at-usage branch November 29, 2022 06:53
@github-actions github-actions bot added this to the 1.2.0 milestone Nov 29, 2022
@jpbempel jpbempel added the comp: debugger Dynamic Instrumentation label Nov 29, 2022
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.

3 participants