diff --git a/dd-java-agent/agent-debugger/build.gradle b/dd-java-agent/agent-debugger/build.gradle index 0ef3992644f..4de4d80151c 100644 --- a/dd-java-agent/agent-debugger/build.gradle +++ b/dd-java-agent/agent-debugger/build.gradle @@ -44,6 +44,9 @@ dependencies { implementation libs.dogstatsd implementation libs.moshi + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation group: 'com.antithesis', name: 'sdk', version: '1.4.5' + testImplementation libs.asm.util testImplementation libs.bundles.junit5 testImplementation libs.junit.jupiter.params diff --git a/dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/agent/ConfigurationUpdater.java b/dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/agent/ConfigurationUpdater.java index 755c15ea667..ab37c5c187c 100644 --- a/dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/agent/ConfigurationUpdater.java +++ b/dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/agent/ConfigurationUpdater.java @@ -34,6 +34,7 @@ import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.antithesis.sdk.Assert; /** * Handles configuration updates if required by installing a new ClassFileTransformer and triggering @@ -95,6 +96,8 @@ public void accept(Source source, Collection definiti applyNewConfiguration(newConfiguration); } catch (RuntimeException e) { ExceptionHelper.logException(LOGGER, e, "Error during accepting new debugger configuration:"); + LOGGER.debug("ANTITHESIS_ASSERT: ConfigurationUpdater.accept should sometimes throw a runtime exception (sometimes)"); + Assert.sometimes(true, "ConfigurationUpdater.accept should sometimes throw a runtime exception", null); throw e; } } @@ -143,9 +146,15 @@ private void applyNewConfiguration(Configuration newConfiguration) { currentConfiguration = newConfiguration; if (changes.hasProbeRelatedChanges()) { LOGGER.debug("Applying new probe configuration, changes: {}", changes); + LOGGER.debug("ANTITHESIS_ASSERT: ConfigurationUpdater.handleProbesChanges should sometimes be called (sometimes)"); + Assert.sometimes(true, "ConfigurationUpdater.handleProbesChanges should sometimes be called", null); handleProbesChanges(changes, newConfiguration); } + LOGGER.debug("ANTITHESIS_ASSERT: ConfigurationUpdater.applyNewConfiguration should always be successful (always)"); + Assert.always(true, "ConfigurationUpdater.applyNewConfiguration should always be successful", null); } finally { + LOGGER.debug("ANTITHESIS_ASSERT: ConfigurationUpdater.applyNewConfiguration should always be reachable (reachable)"); + Assert.reachable("ConfigurationUpdater.applyNewConfiguration should always be reachable", null); configurationLock.unlock(); } } diff --git a/dd-java-agent/agent-profiling/build.gradle b/dd-java-agent/agent-profiling/build.gradle index a53ac40d8fe..f46d991de55 100644 --- a/dd-java-agent/agent-profiling/build.gradle +++ b/dd-java-agent/agent-profiling/build.gradle @@ -20,6 +20,9 @@ dependencies { api libs.slf4j api project(':internal-api') + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation group: 'com.antithesis', name: 'sdk', version: '1.4.5' + api project(':dd-java-agent:agent-profiling:profiling-ddprof') api project(':dd-java-agent:agent-profiling:profiling-uploader') api project(':dd-java-agent:agent-profiling:profiling-controller') diff --git a/dd-java-agent/agent-profiling/profiling-controller-openjdk/build.gradle b/dd-java-agent/agent-profiling/profiling-controller-openjdk/build.gradle index 61c9e9a57bf..1d797db2069 100644 --- a/dd-java-agent/agent-profiling/profiling-controller-openjdk/build.gradle +++ b/dd-java-agent/agent-profiling/profiling-controller-openjdk/build.gradle @@ -26,6 +26,9 @@ dependencies { api project(':dd-java-agent:agent-profiling:profiling-controller') api project(':dd-java-agent:agent-profiling:profiling-controller-jfr') + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation group: 'com.antithesis', name: 'sdk', version: '1.4.5' + testImplementation libs.bundles.junit5 testImplementation libs.bundles.mockito testImplementation files(project(':dd-java-agent:agent-profiling:profiling-controller-jfr').sourceSets.test.output) diff --git a/dd-java-agent/agent-profiling/profiling-controller-openjdk/src/main/java/com/datadog/profiling/controller/openjdk/OpenJdkController.java b/dd-java-agent/agent-profiling/profiling-controller-openjdk/src/main/java/com/datadog/profiling/controller/openjdk/OpenJdkController.java index b8e775d4fb1..2fe9d6d0567 100644 --- a/dd-java-agent/agent-profiling/profiling-controller-openjdk/src/main/java/com/datadog/profiling/controller/openjdk/OpenJdkController.java +++ b/dd-java-agent/agent-profiling/profiling-controller-openjdk/src/main/java/com/datadog/profiling/controller/openjdk/OpenJdkController.java @@ -50,6 +50,7 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.antithesis.sdk.Assert; /** * This is the implementation of the controller for OpenJDK. It should work for JDK 11+ today, and @@ -289,6 +290,8 @@ private static String getJfrRepositoryBase(ConfigProvider configProvider) { Files.createDirectories(repositoryPath); } catch (IOException e) { log.error("Failed to create JFR repository directory: {}", repositoryPath, e); + log.debug("ANTITHESIS_ASSERT: Failed to create JFR repository directory (unreachable)"); + Assert.unreachable("Failed to create JFR repository directory", null); throw new IllegalStateException( "Failed to create JFR repository directory: " + repositoryPath, e); } diff --git a/dd-java-agent/agent-profiling/profiling-controller/build.gradle b/dd-java-agent/agent-profiling/profiling-controller/build.gradle index e255fdf668d..c5820188739 100644 --- a/dd-java-agent/agent-profiling/profiling-controller/build.gradle +++ b/dd-java-agent/agent-profiling/profiling-controller/build.gradle @@ -22,6 +22,9 @@ dependencies { api project(':components:environment') api project(':dd-java-agent:agent-profiling:profiling-utils') + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation group: 'com.antithesis', name: 'sdk', version: '1.4.5' + testImplementation libs.bundles.junit5 testImplementation libs.guava testImplementation libs.bundles.mockito diff --git a/dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller/ProfilingSystem.java b/dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller/ProfilingSystem.java index 7f57b356d99..f3af9fede8d 100644 --- a/dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller/ProfilingSystem.java +++ b/dd-java-agent/agent-profiling/profiling-controller/src/main/java/com/datadog/profiling/controller/ProfilingSystem.java @@ -35,6 +35,7 @@ import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.antithesis.sdk.Assert; /** Sets up the profiling strategy and schedules the profiling recordings. */ public final class ProfilingSystem { @@ -196,9 +197,12 @@ private void startProfilingRecording() { if (t != null) { if (t instanceof IllegalStateException && "Shutdown in progress".equals(t.getMessage())) { ProfilerFlareLogger.getInstance().log("Shutdown in progress, cannot start profiling"); + log.debug("ANTITHESIS_ASSERT: Shutdown in progress, cannot start profiling (sometimes)"); + Assert.sometimes(true, "Shutdown in progress, cannot start profiling", null); } else { ProfilerFlareLogger.getInstance().log("Failed to start profiling", t); - + log.debug("ANTITHESIS_ASSERT: Failed to start profiling (unreachable)", t); + Assert.unreachable("Failed to start profiling", null); throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t); } } @@ -275,6 +279,8 @@ public void snapshot(boolean onShutdown) { // the last recording end time plus one nano second. The reason for this is that when // JFR is filtering the stream it will only discard earlier chunks that have an end // time that is before (not before or equal to) the requested start time of the filter. + log.debug("ANTITHESIS_ASSERT: Snapshot created (always) - lastSnapshot != null: {}", (lastSnapshot != null)); + Assert.always(lastSnapshot != null, "Snapshot created", null); lastSnapshot = recordingData.getEnd().plus(ONE_NANO); dataListener.onNewData(recordingType, recordingData, onShutdown); } else { @@ -282,6 +288,8 @@ public void snapshot(boolean onShutdown) { } } catch (final Exception e) { log.error(SEND_TELEMETRY, "Exception in profiling thread, continuing", e); + log.debug("ANTITHESIS_ASSERT: Exception in profiling thread, continuing (unreachable)", e); + Assert.unreachable("Exception in profiling thread, continuing", null); } catch (final Throwable t) { /* Try to continue even after fatal exception. It seems to be useful to attempt to store profile when this happens. @@ -294,6 +302,8 @@ public void snapshot(boolean onShutdown) { } catch (final Throwable t2) { // This should almost never happen and there is not much we can do here in cases like // OutOfMemoryError, so we will just ignore this. + log.debug("ANTITHESIS_ASSERT: Fatal exception in profiling thread, trying to continue (unreachable)"); + Assert.unreachable("Fatal exception in profiling thread, trying to continue", null); } } } diff --git a/dd-java-agent/agent-profiling/profiling-ddprof/build.gradle b/dd-java-agent/agent-profiling/profiling-ddprof/build.gradle index 2664a8945ac..8350eda97f4 100644 --- a/dd-java-agent/agent-profiling/profiling-ddprof/build.gradle +++ b/dd-java-agent/agent-profiling/profiling-ddprof/build.gradle @@ -36,6 +36,9 @@ dependencies { implementation libs.slf4j + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation group: 'com.antithesis', name: 'sdk', version: '1.4.5' + testImplementation libs.bundles.jmc testImplementation libs.bundles.junit5 } diff --git a/dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java b/dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java index 0c889108d2d..8f1820b7393 100644 --- a/dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java +++ b/dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfiler.java @@ -56,7 +56,7 @@ import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - +import com.antithesis.sdk.Assert; /** * It is currently assumed that this class can be initialised early so that Datadog profiler's * thread filter captures all tracing activity, which means it must not be modified to depend on @@ -189,6 +189,8 @@ public OngoingRecording start() { return new DatadogProfilerRecording(this); } catch (IOException | IllegalStateException e) { log.debug("Failed to start Datadog profiler recording", e); + log.debug("ANTITHESIS_ASSERT: Failed to start Datadog profiler recording (unreachable)"); + Assert.unreachable("Failed to start Datadog profiler recording", null); return null; } } @@ -203,12 +205,16 @@ public RecordingData stop(OngoingRecording recording) { void stopProfiler() { if (recordingFlag.compareAndSet(true, false)) { profiler.stop(); + log.debug("ANTITHESIS_ASSERT: Checking if profiling is still active after stop (sometimes) - active: {}", isActive()); + Assert.sometimes(isActive(),"Profiling is still active. Waiting to stop.", null); if (isActive()) { log.debug("Profiling is still active. Waiting to stop."); while (isActive()) { LockSupport.parkNanos(10_000_000L); } } + log.debug("ANTITHESIS_ASSERT: Profiling should be stopped (always) - active: {}", isActive()); + Assert.always(!isActive(),"Profiling is stopped", null); } } @@ -222,6 +228,8 @@ public boolean isActive() { log.debug("Datadog Profiler Status = {}", status); return !status.contains("not active"); } catch (IOException ignored) { + log.debug("ANTITHESIS_ASSERT: Failed to get Datadog profiler status (unreachable)"); + Assert.unreachable("Failed to get Datadog profiler status", null); } return false; } @@ -244,10 +252,14 @@ Path newRecording() throws IOException, IllegalStateException { log.warn("Unable to start Datadog profiler recording: {}", e.getMessage()); } recordingFlag.set(false); + log.debug("ANTITHESIS_ASSERT: Unable to start Datadog profiler recording (unreachable)"); + Assert.unreachable("Unable to start Datadog profiler recording", null); throw e; } return recFile; } + log.debug("ANTITHESIS_ASSERT: Datadog profiler session has already been started (unreachable)"); + Assert.unreachable("Datadog profiler session has already been started", null); throw new IllegalStateException("Datadog profiler session has already been started"); } diff --git a/dd-java-agent/agent-profiling/profiling-uploader/build.gradle b/dd-java-agent/agent-profiling/profiling-uploader/build.gradle index f9a03e3a917..3672a3d5d1c 100644 --- a/dd-java-agent/agent-profiling/profiling-uploader/build.gradle +++ b/dd-java-agent/agent-profiling/profiling-uploader/build.gradle @@ -33,6 +33,9 @@ dependencies { implementation libs.lz4 implementation libs.aircompressor + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation group: 'com.antithesis', name: 'sdk', version: '1.4.5' + testImplementation project(':dd-java-agent:agent-profiling:profiling-testing') testImplementation project(':utils:test-utils') testImplementation libs.bundles.junit5 diff --git a/dd-java-agent/agent-profiling/profiling-uploader/src/main/java/com/datadog/profiling/uploader/ProfileUploader.java b/dd-java-agent/agent-profiling/profiling-uploader/src/main/java/com/datadog/profiling/uploader/ProfileUploader.java index ab588da6e1a..0ca6737d926 100644 --- a/dd-java-agent/agent-profiling/profiling-uploader/src/main/java/com/datadog/profiling/uploader/ProfileUploader.java +++ b/dd-java-agent/agent-profiling/profiling-uploader/src/main/java/com/datadog/profiling/uploader/ProfileUploader.java @@ -69,6 +69,7 @@ import okhttp3.ResponseBody; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.antithesis.sdk.Assert; /** The class for uploading profiles to the backend. */ public final class ProfileUploader { @@ -301,6 +302,8 @@ public void onFailure(final Call call, final IOException e) { // But, in any case, we have this safety-break in place to prevent blocking finishing the // sync request to a misbehaving server. if (handled.compareAndSet(false, true)) { + log.debug("ANTITHESIS_ASSERT: Upload timeout (unreachable)"); + Assert.unreachable("Upload timeout", null); handleFailure(call, null, data, onCompletion); } } @@ -351,6 +354,8 @@ private void handleResponse( "Failed to upload profile, it's too big. Dumping information about the profile"); JfrCliHelper.invokeOn(data, ioLogger); } else { + log.debug("ANTITHESIS_ASSERT: Failed to upload profile (unreachable) - response code: {}", response.code()); + Assert.unreachable("Failed to upload profile", null); ioLogger.error("Failed to upload profile", getLoggerResponse(response)); } } diff --git a/dd-java-agent/agent-profiling/src/main/java/com/datadog/profiling/agent/ProfilingAgent.java b/dd-java-agent/agent-profiling/src/main/java/com/datadog/profiling/agent/ProfilingAgent.java index c73b618edb8..3d27d6c4cd1 100644 --- a/dd-java-agent/agent-profiling/src/main/java/com/datadog/profiling/agent/ProfilingAgent.java +++ b/dd-java-agent/agent-profiling/src/main/java/com/datadog/profiling/agent/ProfilingAgent.java @@ -37,6 +37,7 @@ import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.antithesis.sdk.Assert; /** Profiling agent implementation */ public class ProfilingAgent { @@ -81,6 +82,8 @@ public void onNewData(RecordingType type, RecordingData data, boolean handleSync log.debug("Debug profile stored as {}", tmp); } catch (IOException e) { log.debug("Unable to write debug profile dump", e); + log.debug("ANTITHESIS_ASSERT: Unable to write debug profile dump (unreachable)"); + Assert.unreachable("Unable to write debug profile dump", null); } } } @@ -169,11 +172,15 @@ public static synchronized boolean run(final boolean earlyStart, Instrumentation This means that if/when we implement functionality to manually shutdown profiler we would need to not forget to add code that removes this shutdown hook from JVM. */ + log.debug("ANTITHESIS_ASSERT: Shutdown hook added (always) - uploader != null: {}", (uploader != null)); + Assert.always(uploader!= null, "Shutdown hook added", null); Runtime.getRuntime().addShutdownHook(new ShutdownHook(profiler, uploader)); } catch (final IllegalStateException ex) { // The JVM is already shutting down. } } catch (final UnsupportedEnvironmentException | ConfigurationException e) { + log.debug("ANTITHESIS_ASSERT: Failed to initialize profiling agent (unreachable)", e); + Assert.unreachable("Failed to initialize profiling agent!", null); ProfilerFlareLogger.getInstance().log("Failed to initialize profiling agent!", e); ProfilerFlareReporter.reportInitializationException(e); } diff --git a/dd-trace-core/build.gradle b/dd-trace-core/build.gradle index 7b111ed4e38..e8435598169 100644 --- a/dd-trace-core/build.gradle +++ b/dd-trace-core/build.gradle @@ -80,6 +80,9 @@ dependencies { implementation group: 'com.google.re2j', name: 're2j', version: '1.7' + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation group: 'com.antithesis', name: 'sdk', version: '1.4.5' + compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: '4.2.0' // We have autoservices defined in test subtree, looks like we need this to be able to properly rebuild this diff --git a/dd-trace-core/src/main/java/datadog/trace/common/writer/PayloadDispatcherImpl.java b/dd-trace-core/src/main/java/datadog/trace/common/writer/PayloadDispatcherImpl.java index a0011216770..542d73f7cf0 100644 --- a/dd-trace-core/src/main/java/datadog/trace/common/writer/PayloadDispatcherImpl.java +++ b/dd-trace-core/src/main/java/datadog/trace/common/writer/PayloadDispatcherImpl.java @@ -109,6 +109,7 @@ public void accept(int messageCount, ByteBuffer buffer) { healthMetrics.onSerialize(sizeInBytes); RemoteApi.Response response = api.sendSerializedTraces(payload); mapper.reset(); + if (response.success()) { if (log.isDebugEnabled()) { log.debug("Successfully sent {} traces to the API", messageCount); diff --git a/remote-config/remote-config-core/build.gradle.kts b/remote-config/remote-config-core/build.gradle.kts index f3d0200b797..3c90599ee00 100644 --- a/remote-config/remote-config-core/build.gradle.kts +++ b/remote-config/remote-config-core/build.gradle.kts @@ -37,6 +37,9 @@ dependencies { implementation(libs.moshi) implementation(libs.bundles.cafe.crypto) + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation(group = "com.antithesis", name = "sdk", version = "1.4.5") + implementation(project(":internal-api")) testImplementation(project(":utils:test-utils")) diff --git a/remote-config/remote-config-core/src/main/java/datadog/remoteconfig/DefaultConfigurationPoller.java b/remote-config/remote-config-core/src/main/java/datadog/remoteconfig/DefaultConfigurationPoller.java index 43863d1699b..332a406865d 100644 --- a/remote-config/remote-config-core/src/main/java/datadog/remoteconfig/DefaultConfigurationPoller.java +++ b/remote-config/remote-config-core/src/main/java/datadog/remoteconfig/DefaultConfigurationPoller.java @@ -51,6 +51,7 @@ import okio.ByteString; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.antithesis.sdk.Assert; /** Handles polling debugger configuration from datadog agent/Remote Configuration */ public class DefaultConfigurationPoller @@ -281,8 +282,10 @@ private boolean initialize() { new PollerRequestFactory(config, tracerVersion, containerId, entityId, url, moshi); } catch (Exception e) { // We can't recover from this, so we'll not try to initialize again. - fatalOnInitialization = true; log.error("Remote configuration poller initialization failed", e); + log.debug("ANTITHESIS_ASSERT: Remote configuration poller initialization failed (unreachable)", e); + Assert.unreachable("Remote configuration poller initialization failed", null); + fatalOnInitialization = true; } return true; } @@ -379,6 +382,8 @@ private void handleAgentResponse(ResponseBody body) { } catch (Exception e) { // no error can be reported, as we don't have the data client.state.targets_version avail ratelimitedLogger.warn("Error parsing remote config response", e); + log.debug("ANTITHESIS_ASSERT: Error parsing remote config response (unreachable)", e); + Assert.unreachable("Error parsing remote config response", null); return; } @@ -446,6 +451,8 @@ private void runConfigurationEndListener( ConfigurationEndListener listener, List errors) { try { listener.onConfigurationEnd(); + log.debug("ANTITHESIS_ASSERT: Configuration end listener should always be reachable (reachable)"); + Assert.reachable("Configuration end listener should always be reachable", null); } catch (ReportableException re) { errors.add(re); } catch (RuntimeException rte) { @@ -454,6 +461,8 @@ private void runConfigurationEndListener( // is about combining configuration from different products ratelimitedLogger.warn( "Error running configuration listener {}: {}", listener, rte.getMessage(), rte); + log.debug("ANTITHESIS_ASSERT: Error running configuration listener (unreachable)", rte); + Assert.unreachable("Error running configuration listener", null); } } diff --git a/telemetry/build.gradle.kts b/telemetry/build.gradle.kts index 1b66facc063..77c95d3a48d 100644 --- a/telemetry/build.gradle.kts +++ b/telemetry/build.gradle.kts @@ -34,6 +34,9 @@ dependencies { implementation(libs.slf4j) implementation(project(":internal-api")) + + // Antithesis SDK for assertions and property testing - bundled in tracer JAR + implementation(group = "com.antithesis", name = "sdk", version = "1.4.5") compileOnly(project(":dd-java-agent:agent-tooling")) testImplementation(project(":dd-java-agent:agent-tooling")) diff --git a/telemetry/src/main/java/datadog/telemetry/TelemetryClient.java b/telemetry/src/main/java/datadog/telemetry/TelemetryClient.java index c13411e0e69..c0f7f26bfe0 100644 --- a/telemetry/src/main/java/datadog/telemetry/TelemetryClient.java +++ b/telemetry/src/main/java/datadog/telemetry/TelemetryClient.java @@ -98,9 +98,11 @@ public Result sendHttpRequest(Request.Builder httpRequestBuilder) { try (okhttp3.Response response = OkHttpUtils.sendWithRetries(okHttpClient, httpRetryPolicy, httpRequest)) { if (response.code() == 404) { + log.debug("Telemetry endpoint is disabled, dropping {} message.", requestType); return Result.NOT_FOUND; } + if (!response.isSuccessful()) { log.debug( "Telemetry message {} failed with: {} {}.", @@ -109,6 +111,7 @@ public Result sendHttpRequest(Request.Builder httpRequestBuilder) { response.message()); return Result.FAILURE; } + } catch (InterruptedIOException e) { log.debug("Telemetry message {} sending interrupted: {}.", requestType, e.toString()); return Result.INTERRUPTED; diff --git a/telemetry/src/main/java/datadog/telemetry/TelemetryRouter.java b/telemetry/src/main/java/datadog/telemetry/TelemetryRouter.java index 1636f865def..801d6743ae7 100644 --- a/telemetry/src/main/java/datadog/telemetry/TelemetryRouter.java +++ b/telemetry/src/main/java/datadog/telemetry/TelemetryRouter.java @@ -41,6 +41,7 @@ public TelemetryClient.Result sendRequest(TelemetryRequest request) { // interrupted request is most likely due to telemetry system shutdown, // we do not want to log errors and reattempt in this case && result != TelemetryClient.Result.INTERRUPTED; + if (currentClient == agentClient) { if (requestFailed) { reportErrorOnce(currentClient.getUrl(), result); diff --git a/telemetry/src/main/java/datadog/telemetry/dependency/DependencyResolver.java b/telemetry/src/main/java/datadog/telemetry/dependency/DependencyResolver.java index 91ec8c52162..1abd3d18067 100644 --- a/telemetry/src/main/java/datadog/telemetry/dependency/DependencyResolver.java +++ b/telemetry/src/main/java/datadog/telemetry/dependency/DependencyResolver.java @@ -1,5 +1,8 @@ package datadog.telemetry.dependency; +import com.antithesis.sdk.Assert; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -41,6 +44,18 @@ static List internalResolve(final URI uri) throws IOException { return Collections.emptyList(); } if (metadata.isDirectory) { + // Antithesis: Track when dependencies are extracted from directories + ObjectNode directoryDetails = JsonNodeFactory.instance.objectNode(); + directoryDetails.put("uri", uri.toString()); + directoryDetails.put("scheme", scheme); + directoryDetails.put("is_directory", true); + + log.debug("ANTITHESIS_ASSERT: Directory dependency extraction attempted (sometimes) - uri: {}", uri); + Assert.sometimes( + metadata.isDirectory, + "Directory dependencies are encountered - tracking unsupported dependency type", + directoryDetails); + log.debug("Extracting dependencies from directories is not supported: {}", uri); return Collections.emptyList(); }