File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed
agent-bootstrap/src/main/java/datadog/trace/bootstrap/benchmark
agent-builder/src/main/java/datadog/trace/agent/tooling
src/test/groovy/datadog/trace/agent Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1
1
package datadog .trace .bootstrap .benchmark ;
2
2
3
+ import datadog .environment .SystemProperties ;
3
4
import java .io .*;
4
5
import java .nio .charset .StandardCharsets ;
5
6
import java .util .Objects ;
@@ -18,8 +19,8 @@ public class StaticEventLogger {
18
19
static {
19
20
BufferedWriter writer = null ;
20
21
21
- if ("true" .equalsIgnoreCase (System . getProperty ("dd.benchmark.enabled" ))) {
22
- String dir = System . getProperty ("dd.benchmark.output.dir" );
22
+ if ("true" .equalsIgnoreCase (SystemProperties . get ("dd.benchmark.enabled" ))) {
23
+ String dir = SystemProperties . get ("dd.benchmark.output.dir" );
23
24
dir = (dir != null ? dir + File .separator : "" );
24
25
String fileName = dir + "startup_" + System .currentTimeMillis () + ".csv" ;
25
26
Original file line number Diff line number Diff line change 5
5
import static datadog .trace .agent .tooling .bytebuddy .matcher .GlobalIgnoresMatcher .globalIgnoresMatcher ;
6
6
import static net .bytebuddy .matcher .ElementMatchers .isDefaultFinalizer ;
7
7
8
+ import datadog .environment .SystemProperties ;
8
9
import datadog .trace .agent .tooling .bytebuddy .SharedTypePools ;
9
10
import datadog .trace .agent .tooling .bytebuddy .iast .TaintableRedefinitionStrategyListener ;
10
11
import datadog .trace .agent .tooling .bytebuddy .matcher .DDElementMatchers ;
@@ -318,18 +319,17 @@ public static Set<InstrumenterModule.TargetSystem> getEnabledSystems() {
318
319
}
319
320
320
321
private static void addByteBuddyRawSetting () {
321
- final String savedPropertyValue = System .getProperty (TypeDefinition .RAW_TYPES_PROPERTY );
322
- try {
323
- System .setProperty (TypeDefinition .RAW_TYPES_PROPERTY , "true" );
322
+ final String savedPropertyValue = SystemProperties .get (TypeDefinition .RAW_TYPES_PROPERTY );
323
+ if (SystemProperties .set (TypeDefinition .RAW_TYPES_PROPERTY , "true" )) {
324
324
final boolean rawTypes = TypeDescription .AbstractBase .RAW_TYPES ;
325
325
if (!rawTypes && DEBUG ) {
326
326
log .debug ("Too late to enable {}" , TypeDefinition .RAW_TYPES_PROPERTY );
327
327
}
328
- } finally {
328
+ } else {
329
329
if (savedPropertyValue == null ) {
330
- System . clearProperty (TypeDefinition .RAW_TYPES_PROPERTY );
330
+ SystemProperties . clear (TypeDefinition .RAW_TYPES_PROPERTY );
331
331
} else {
332
- System . setProperty (TypeDefinition .RAW_TYPES_PROPERTY , savedPropertyValue );
332
+ SystemProperties . set (TypeDefinition .RAW_TYPES_PROPERTY , savedPropertyValue );
333
333
}
334
334
}
335
335
}
Original file line number Diff line number Diff line change @@ -55,15 +55,15 @@ class InitializationTelemetryTest extends Specification {
55
55
56
56
def " incomplete agent start-up" () {
57
57
// In this case, the SecurityManager blocks a custom permission that is checked by bytebuddy causing
58
- // agent initialization to fail. However, we should catch the exception allowing the application
58
+ // agent initialization to fail. However, we should catch the exception allowing the application
59
59
// to run normally.
60
60
when :
61
61
def result = InitializationTelemetryCheck . runTestJvm(InitializationTelemetryCheck.BlockByteBuddy )
62
62
63
- then :
63
+ then : ' should complete successfully and catch error '
64
64
result. exitCode == 0
65
65
! result. telemetryJson. contains(' library_entrypoint.complete' )
66
- result. telemetryJson. contains(' error_type:java.lang.IllegalStateException ' )
66
+ result. telemetryJson. contains(' error_type:' )
67
67
}
68
68
69
69
def " block forwarder env var" () {
You can’t perform that action at this time.
0 commit comments