GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix suspend Kotlin methods instrumentation by jpbempel · Pull Request #8080 · DataDog/dd-trace-java

Fix suspend Kotlin methods instrumentation #8080

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.

Sign up for GitHub

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

Merged
jpbempel merged 2 commits into master from jpbempel/fix-kotlin-suspend-method-probe
Dec 13, 2024

Uh oh!

There was an error while loading. Please reload this page.

Merged

Fix suspend Kotlin methods instrumentation #8080

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
e7adeff
Fix suspend Kotlin method instrumentation
jpbempel Dec 11, 2024
f86bd77
add config for local var hoisting
jpbempel Dec 12, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
add config for local var hoisting
enable only hoisting for java language
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@jpbempel
jpbempel committed Dec 12, 2024
commit f86bd77ed804ac5c6b2450e9aadf9ff8328ebe2e

There are no files selected for viewing

6 changes: 5 additions & 1 deletion 6 ...ugger/src/main/java/com/datadog/debugger/instrumentation/CapturedContextInstrumentor.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,11 @@ private void instrumentMethodEnter() {
if (methodNode.tryCatchBlocks.size() > 0) {
throwableListVar = declareThrowableList(insnList);
}
unscopedLocalVars = initAndHoistLocalVars(insnList);
unscopedLocalVars = Collections.emptyList();
if (Config.get().isDebuggerHoistLocalVarsEnabled() && language == JvmLanguage.JAVA) {
// for now, only hoist local vars for Java
unscopedLocalVars = initAndHoistLocalVars(insnList);
}
insnList.add(contextInitLabel);
if (definition instanceof SpanDecorationProbe
&& definition.getEvaluateAt() == MethodLocation.EXIT) {
Expand Down
29 changes: 29 additions & 0 deletions 29 ...agent/agent-debugger/src/main/java/com/datadog/debugger/instrumentation/Instrumentor.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public abstract class Instrumentor {
protected int localVarBaseOffset;
protected int argOffset;
protected final LocalVariableNode[] localVarsBySlotArray;
protected final JvmLanguage language;
protected LabelNode returnHandlerLabel;
protected final List<CapturedContextInstrumentor.FinallyBlock> finallyBlocks = new ArrayList<>();

Expand All @@ -69,6 +70,7 @@ public Instrumentor(
argOffset += t.getSize();
}
localVarsBySlotArray = extractLocalVariables(argTypes);
this.language = JvmLanguage.of(classNode);
}

public abstract InstrumentationResult.Status instrument();
Expand Down Expand Up @@ -294,4 +296,31 @@ public FinallyBlock(LabelNode startLabel, LabelNode endLabel, LabelNode handlerL
this.handlerLabel = handlerLabel;
}
}

protected enum JvmLanguage {
JAVA,
KOTLIN,
SCALA,
GROOVY,
UNKNOWN;

public static JvmLanguage of(ClassNode classNode) {
if (classNode.sourceFile == null) {
return UNKNOWN;
}
if (classNode.sourceFile.endsWith(".java")) {
return JAVA;
}
if (classNode.sourceFile.endsWith(".kt")) {
return KOTLIN;
}
if (classNode.sourceFile.endsWith(".scala")) {
return SCALA;
}
if (classNode.sourceFile.endsWith(".groovy")) {
return GROOVY;
}
return UNKNOWN;
}
}
}
1 change: 1 addition & 0 deletions 1 dd-trace-api/src/main/java/datadog/trace/api/ConfigDefaults.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public final class ConfigDefaults {
static final boolean DEFAULT_DEBUGGER_VERIFY_BYTECODE = true;
static final boolean DEFAULT_DEBUGGER_INSTRUMENT_THE_WORLD = false;
static final int DEFAULT_DEBUGGER_CAPTURE_TIMEOUT = 100; // milliseconds
static final boolean DEFAULT_DEBUGGER_HOIST_LOCALVARS_ENABLED = true;
static final boolean DEFAULT_DEBUGGER_SYMBOL_ENABLED = true;
static final boolean DEFAULT_DEBUGGER_SYMBOL_FORCE_UPLOAD = false;
static final int DEFAULT_DEBUGGER_SYMBOL_FLUSH_THRESHOLD = 100; // nb of classes
Expand Down
2 changes: 2 additions & 0 deletions 2 dd-trace-api/src/main/java/datadog/trace/api/config/DebuggerConfig.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public final class DebuggerConfig {
public static final String DEBUGGER_REDACTION_EXCLUDED_IDENTIFIERS =
"dynamic.instrumentation.redaction.excluded.identifiers";
public static final String DEBUGGER_REDACTED_TYPES = "dynamic.instrumentation.redacted.types";
public static final String DEBUGGER_HOIST_LOCALVARS_ENABLED =
"dynamic.instrumentation.hoist.localvars.enabled";
public static final String DEBUGGER_SYMBOL_ENABLED = "symbol.database.upload.enabled";
public static final String DEBUGGER_SYMBOL_FORCE_UPLOAD = "internal.force.symbol.database.upload";
public static final String DEBUGGER_SYMBOL_INCLUDES = "symbol.database.includes";
Expand Down
8 changes: 8 additions & 0 deletions 8 internal-api/src/main/java/datadog/trace/api/Config.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ public static String getHostName() {
private final String debuggerRedactedIdentifiers;
private final Set<String> debuggerRedactionExcludedIdentifiers;
private final String debuggerRedactedTypes;
private final boolean debuggerHoistLocalVarsEnabled;
private final boolean debuggerSymbolEnabled;
private final boolean debuggerSymbolForceUpload;
private final String debuggerSymbolIncludes;
Expand Down Expand Up @@ -1526,6 +1527,9 @@ PROFILING_DATADOG_PROFILER_ENABLED, isDatadogProfilerSafeInCurrentEnvironment())
debuggerRedactionExcludedIdentifiers =
tryMakeImmutableSet(configProvider.getList(DEBUGGER_REDACTION_EXCLUDED_IDENTIFIERS));
debuggerRedactedTypes = configProvider.getString(DEBUGGER_REDACTED_TYPES, null);
debuggerHoistLocalVarsEnabled =
configProvider.getBoolean(
DEBUGGER_HOIST_LOCALVARS_ENABLED, DEFAULT_DEBUGGER_HOIST_LOCALVARS_ENABLED);
debuggerSymbolEnabled =
configProvider.getBoolean(DEBUGGER_SYMBOL_ENABLED, DEFAULT_DEBUGGER_SYMBOL_ENABLED);
debuggerSymbolForceUpload =
Expand Down Expand Up @@ -3042,6 +3046,10 @@ public String getDebuggerRedactedTypes() {
return debuggerRedactedTypes;
}

public boolean isDebuggerHoistLocalVarsEnabled() {
return debuggerHoistLocalVarsEnabled;
}

public boolean isAwsPropagationEnabled() {
return awsPropagationEnabled;
}
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.