-
Notifications
You must be signed in to change notification settings - Fork 286
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
rename the DebuggerProbe to TriggerProbe #7737
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,12 +2,12 @@ | |||||
|
||||||
import static com.datadog.debugger.agent.ConfigurationAcceptor.Source.REMOTE_CONFIG; | ||||||
|
||||||
import com.datadog.debugger.probe.DebuggerProbe; | ||||||
import com.datadog.debugger.probe.LogProbe; | ||||||
import com.datadog.debugger.probe.MetricProbe; | ||||||
import com.datadog.debugger.probe.ProbeDefinition; | ||||||
import com.datadog.debugger.probe.SpanDecorationProbe; | ||||||
import com.datadog.debugger.probe.SpanProbe; | ||||||
import com.datadog.debugger.probe.TriggerProbe; | ||||||
import com.datadog.debugger.util.MoshiHelper; | ||||||
import com.squareup.moshi.JsonAdapter; | ||||||
import datadog.remoteconfig.PollingRateHinter; | ||||||
|
@@ -29,15 +29,15 @@ | |||||
import org.slf4j.LoggerFactory; | ||||||
|
||||||
public class DebuggerProductChangesListener implements ProductListener { | ||||||
public static final int MAX_ALLOWED_DEBUGGER_PROBES = 100; | ||||||
public static final int MAX_ALLOWED_TRIGGER_PROBES = 100; | ||||||
public static final int MAX_ALLOWED_METRIC_PROBES = 100; | ||||||
public static final int MAX_ALLOWED_LOG_PROBES = 100; | ||||||
public static final int MAX_ALLOWED_SPAN_PROBES = 100; | ||||||
public static final int MAX_ALLOWED_SPAN_DECORATION_PROBES = 100; | ||||||
public static final String LOG_PROBE_PREFIX = "logProbe_"; | ||||||
public static final String METRIC_PROBE_PREFIX = "metricProbe_"; | ||||||
public static final String SPAN_PROBE_PREFIX = "spanProbe_"; | ||||||
public static final String DEBUGGER_PROBE_PREFIX = "debuggerProbe_"; | ||||||
public static final String TRIGGER_PROBE_PREFIX = "triggerProbe_"; | ||||||
public static final String SPAN_DECORATION_PROBE_PREFIX = "spanDecorationProbe_"; | ||||||
private static final Logger LOGGER = | ||||||
LoggerFactory.getLogger(DebuggerProductChangesListener.class); | ||||||
|
@@ -55,8 +55,8 @@ static class Adapter { | |||||
static final JsonAdapter<SpanProbe> SPAN_PROBE_JSON_ADAPTER = | ||||||
MoshiHelper.createMoshiConfig().adapter(SpanProbe.class); | ||||||
|
||||||
static final JsonAdapter<DebuggerProbe> DEBUGGER_PROBE_JSON_ADAPTER = | ||||||
MoshiHelper.createMoshiConfig().adapter(DebuggerProbe.class); | ||||||
static final JsonAdapter<TriggerProbe> TRIGGER_PROBE_JSON_ADAPTER = | ||||||
MoshiHelper.createMoshiConfig().adapter(TriggerProbe.class); | ||||||
|
||||||
static final JsonAdapter<SpanDecorationProbe> SPAN_DECORATION_PROBE_JSON_ADAPTER = | ||||||
MoshiHelper.createMoshiConfig().adapter(SpanDecorationProbe.class); | ||||||
|
@@ -77,8 +77,8 @@ static SpanProbe deserializeSpanProbe(byte[] content) throws IOException { | |||||
return deserialize(SPAN_PROBE_JSON_ADAPTER, content); | ||||||
} | ||||||
|
||||||
static DebuggerProbe deserializeDebuggerProbe(byte[] content) throws IOException { | ||||||
return deserialize(DEBUGGER_PROBE_JSON_ADAPTER, content); | ||||||
static TriggerProbe deserializeTriggerProbe(byte[] content) throws IOException { | ||||||
return deserialize(TRIGGER_PROBE_JSON_ADAPTER, content); | ||||||
} | ||||||
|
||||||
static SpanDecorationProbe deserializeSpanDecorationProbe(byte[] content) throws IOException { | ||||||
|
@@ -118,9 +118,9 @@ public void accept(ConfigKey configKey, byte[] content, PollingRateHinter pollin | |||||
} else if (configId.startsWith(SPAN_PROBE_PREFIX)) { | ||||||
SpanProbe spanProbe = Adapter.deserializeSpanProbe(content); | ||||||
configChunks.put(configId, definitions -> definitions.add(spanProbe)); | ||||||
} else if (configId.startsWith(DEBUGGER_PROBE_PREFIX)) { | ||||||
DebuggerProbe debuggerProbe = Adapter.deserializeDebuggerProbe(content); | ||||||
configChunks.put(configId, definitions -> definitions.add(debuggerProbe)); | ||||||
} else if (configId.startsWith(TRIGGER_PROBE_PREFIX)) { | ||||||
TriggerProbe triggerProbe = Adapter.deserializeTriggerProbe(content); | ||||||
configChunks.put(configId, definitions -> definitions.add(triggerProbe)); | ||||||
} else if (configId.startsWith(SPAN_DECORATION_PROBE_PREFIX)) { | ||||||
SpanDecorationProbe spanDecorationProbe = Adapter.deserializeSpanDecorationProbe(content); | ||||||
configChunks.put(configId, definitions -> definitions.add(spanDecorationProbe)); | ||||||
|
@@ -161,7 +161,7 @@ public void commit(PollingRateHinter pollingRateHinter) { | |||||
|
||||||
static class DefinitionBuilder { | ||||||
private final Collection<ProbeDefinition> definitions = new ArrayList<>(); | ||||||
private int debuggerProbeCount = 0; | ||||||
private int triggerProbeCount = 0; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 Code Quality Violation
Suggested change
Remove initialization, this is already the default value. (...read more)When initializing fields, prevent initializing fields to the default value. Any additional initialization means more bytecode instructions, and allocating many of these objects may impact your application performance. If you initialize to a default value, remove the initialization. |
||||||
private int metricProbeCount = 0; | ||||||
private int logProbeCount = 0; | ||||||
private int spanProbeCount = 0; | ||||||
|
@@ -194,13 +194,13 @@ void add(SpanProbe probe) { | |||||
spanProbeCount++; | ||||||
} | ||||||
|
||||||
void add(DebuggerProbe probe) { | ||||||
if (debuggerProbeCount >= MAX_ALLOWED_DEBUGGER_PROBES) { | ||||||
LOGGER.debug("Max allowed debugger probes reached, ignoring new probe: {}", probe); | ||||||
void add(TriggerProbe probe) { | ||||||
if (triggerProbeCount >= MAX_ALLOWED_TRIGGER_PROBES) { | ||||||
LOGGER.debug("Max allowed trigger probes reached, ignoring new probe: {}", probe); | ||||||
return; | ||||||
} | ||||||
definitions.add(probe); | ||||||
debuggerProbeCount++; | ||||||
triggerProbeCount++; | ||||||
} | ||||||
|
||||||
void add(SpanDecorationProbe probe) { | ||||||
|
@@ -220,8 +220,8 @@ void addAll(Collection<ProbeDefinition> newDefinitions) { | |||||
add((LogProbe) definition); | ||||||
} else if (definition instanceof SpanProbe) { | ||||||
add((SpanProbe) definition); | ||||||
} else if (definition instanceof DebuggerProbe) { | ||||||
add((DebuggerProbe) definition); | ||||||
} else if (definition instanceof TriggerProbe) { | ||||||
add((TriggerProbe) definition); | ||||||
} else if (definition instanceof SpanDecorationProbe) { | ||||||
add((SpanDecorationProbe) definition); | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
single if statement should be wrapped in a brace (...read more)
Omitting braces
{}
is valid in multiple statements, such as, for loops, if statements, and while loops. However, enforcing the use of control braces throughout your codebase will make the code more consistent and can make it easier to add statements in the future.