Skip to content

Commit

Permalink
Rename NONE -> DEFAULT
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbempel committed Nov 28, 2022
1 parent 1c9e94c commit b184e07
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void addCapturingProbeId(ProbeDetails probe) {
public void setEntry(CapturedContext context) {
summaryBuilder.addEntry(context);
context.setThisClassName(thisClassName);
if ((probe.getEvaluateAt() == MethodLocation.NONE
if ((probe.getEvaluateAt() == MethodLocation.DEFAULT
|| probe.getEvaluateAt() == MethodLocation.ENTRY)
&& checkCapture(context)) {
captures.setEntry(context);
Expand All @@ -104,7 +104,7 @@ public void setExit(CapturedContext context) {
context.addExtension(ValueReferences.DURATION_EXTENSION_NAME, duration);
summaryBuilder.addExit(context);
context.setThisClassName(thisClassName);
if ((probe.getEvaluateAt() == MethodLocation.NONE
if ((probe.getEvaluateAt() == MethodLocation.DEFAULT
|| probe.getEvaluateAt() == MethodLocation.EXIT)
&& checkCapture(context)) {
captures.setReturn(context);
Expand Down Expand Up @@ -296,7 +296,7 @@ public enum Kind {
}

public enum MethodLocation {
NONE,
DEFAULT,
ENTRY,
EXIT
}
Expand All @@ -320,7 +320,7 @@ public ProbeDetails(String id, ProbeLocation location) {
this(
id,
location,
MethodLocation.NONE,
MethodLocation.DEFAULT,
null,
null,
new SnapshotSummaryBuilder(location),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ private Snapshot.ProbeDetails convertToProbeDetails(
private Snapshot.MethodLocation convertMethodLocation(
ProbeDefinition.MethodLocation methodLocation) {
switch (methodLocation) {
case NONE:
return Snapshot.MethodLocation.NONE;
case DEFAULT:
return Snapshot.MethodLocation.DEFAULT;
case ENTRY:
return Snapshot.MethodLocation.ENTRY;
case EXIT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void instrument() {
} else {
switch (definition.getEvaluateAt()) {
case ENTRY:
case NONE:
case DEFAULT:
{
InsnList insnList = callMetric(metricProbe);
methodNode.instructions.insert(methodEnterLabel, insnList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public String toString() {
// no-arg constructor is required by Moshi to avoid creating instance with unsafe and by-passing
// constructors, including field initializers.
public LogProbe() {
this(LANGUAGE, null, true, null, null, MethodLocation.NONE, null, new ArrayList<>());
this(LANGUAGE, null, true, null, null, MethodLocation.DEFAULT, null, new ArrayList<>());
}

public LogProbe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public enum MetricKind {
// no-arg constructor is required by Moshi to avoid creating instance with unsafe and by-passing
// constructors, including field initializers.
public MetricProbe() {
this(LANGUAGE, null, true, null, null, MethodLocation.NONE, MetricKind.COUNT, null, null);
this(LANGUAGE, null, true, null, null, MethodLocation.DEFAULT, MetricKind.COUNT, null, null);
}

public MetricProbe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class ProbeDefinition {
protected static final String LANGUAGE = "java";

public enum MethodLocation {
NONE,
DEFAULT,
ENTRY,
EXIT;
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public abstract static class Builder<T extends Builder> {
protected boolean active = true;
protected String[] tagStrs;
protected Where where;
protected MethodLocation evaluateAt = MethodLocation.NONE;
protected MethodLocation evaluateAt = MethodLocation.DEFAULT;

public T language(String language) {
this.language = language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public SnapshotProbe() {
true,
null,
new Where(),
MethodLocation.NONE,
MethodLocation.DEFAULT,
null,
null,
null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ private Snapshot.ProbeDetails resolver(
return new Snapshot.ProbeDetails(
id,
location,
Snapshot.MethodLocation.NONE,
Snapshot.MethodLocation.DEFAULT,
probe.getProbeCondition(),
probe.concatTags(),
new SnapshotSummaryBuilder(location),
Expand All @@ -1317,7 +1317,7 @@ private Snapshot.ProbeDetails resolver(
new Snapshot.ProbeDetails(
relatedProbe.getId(),
location,
Snapshot.MethodLocation.NONE,
Snapshot.MethodLocation.DEFAULT,
((SnapshotProbe) relatedProbe).getProbeCondition(),
relatedProbe.concatTags(),
new SnapshotSummaryBuilder(location)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private Snapshot.ProbeDetails resolver(
return new Snapshot.ProbeDetails(
id,
location,
Snapshot.MethodLocation.NONE,
Snapshot.MethodLocation.DEFAULT,
null,
probe.concatTags(),
new LogMessageTemplateSummaryBuilder(probe),
Expand All @@ -249,7 +249,7 @@ private Snapshot.ProbeDetails resolver(
new Snapshot.ProbeDetails(
relatedProbe.getId(),
location,
Snapshot.MethodLocation.NONE,
Snapshot.MethodLocation.DEFAULT,
relatedProbe instanceof SnapshotProbe
? ((SnapshotProbe) relatedProbe).getProbeCondition()
: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public void roundtripCondition() throws IOException {
new Snapshot.ProbeDetails(
PROBE_ID,
PROBE_LOCATION,
Snapshot.MethodLocation.DEFAULT,
new ProbeCondition(DSL.when(DSL.gt(DSL.ref("^n"), DSL.value(0))), "^n > 0"),
"",
new SnapshotSummaryBuilder(PROBE_LOCATION)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"snapshot":\{
"captures":\{\},
"language":"java",
"probe":\{"evaluateAt":"NONE","id":"12fd-8490-c111-4374-ffde","location":\{"method":"indexOf","type":"java.lang.String"\}\},
"probe":\{"evaluateAt":"DEFAULT","id":"12fd-8490-c111-4374-ffde","location":\{"method":"indexOf","type":"java.lang.String"\}\},
"stack":\[\],
"timestamp":\d+
\}\},
Expand All @@ -24,7 +24,7 @@
"snapshot":\{
"captures":\{\},
"language":"java",
"probe":\{"evaluateAt":"NONE","id":"12fd-8490-c111-4374-ffde","location":\{"method":"indexOf","type":"java.lang.String"\}\},
"probe":\{"evaluateAt":"DEFAULT","id":"12fd-8490-c111-4374-ffde","location":\{"method":"indexOf","type":"java.lang.String"\}\},
"stack":\[\],
"timestamp":\d+
\}\},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
\},
"language":"java",
"probe":\{
"evaluateAt":"NONE",
"evaluateAt":"DEFAULT",
"id":"12fd-8490-c111-4374-ffde",
"location":\{
"file":"String.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"snapshot":\{
"captures":\{\},
"language":"java",
"probe":\{"evaluateAt":"NONE","id":"12fd-8490-c111-4374-ffde","location":\{"method":"indexOf","type":"java.lang.String"\}\},
"probe":\{"evaluateAt":"DEFAULT","id":"12fd-8490-c111-4374-ffde","location":\{"method":"indexOf","type":"java.lang.String"\}\},
"stack":\[\],
"timestamp":\d+
\}\},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"snapshot":\{
"captures":\{"entry":\{"arguments":\{\},"locals":\{\}\}\},
"language":"java",
"probe":\{"evaluateAt":"NONE","id":"12fd-8490-c111-4374-ffde","location":\{"method":"indexOf","type":"java.lang.String"\}\},
"probe":\{"evaluateAt":"DEFAULT","id":"12fd-8490-c111-4374-ffde","location":\{"method":"indexOf","type":"java.lang.String"\}\},
"stack":\[\],
"timestamp":\d+
\}\},
Expand Down

0 comments on commit b184e07

Please sign in to comment.