Skip to content

Commit

Permalink
Add configurable Dependency service resolution period (#8079)
Browse files Browse the repository at this point in the history
  • Loading branch information
jandro996 authored Dec 12, 2024
1 parent 4573a38 commit fd1f40f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public final class GeneralConfig {
public static final String AGENTLESS_LOG_SUBMISSION_ENABLED = "agentless.log.submission.enabled";
public static final String AGENTLESS_LOG_SUBMISSION_QUEUE_SIZE =
"agentless.log.submission.queue.size";
public static final String TELEMETRY_DEPENDENCY_RESOLUTION_PERIOD_MILLIS =
"telemetry.dependency.resolution.period.millis";
public static final String AGENTLESS_LOG_SUBMISSION_LEVEL = "agentless.log.submission.level";
public static final String AGENTLESS_LOG_SUBMISSION_URL = "agentless.log.submission.url";

Expand Down
11 changes: 11 additions & 0 deletions internal-api/src/main/java/datadog/trace/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ public static String getHostName() {
private final int cloudPayloadTaggingMaxDepth;
private final int cloudPayloadTaggingMaxTags;

private final long dependecyResolutionPeriodMillis;

// Read order: System Properties -> Env Variables, [-> properties file], [-> default value]
private Config() {
this(ConfigProvider.createDefault());
Expand Down Expand Up @@ -1802,6 +1804,11 @@ PROFILING_DATADOG_PROFILER_ENABLED, isDatadogProfilerSafeInCurrentEnvironment())
this.cloudPayloadTaggingMaxTags =
configProvider.getInteger(TracerConfig.TRACE_CLOUD_PAYLOAD_TAGGING_MAX_TAGS, 758);

this.dependecyResolutionPeriodMillis =
configProvider.getLong(
GeneralConfig.TELEMETRY_DEPENDENCY_RESOLUTION_PERIOD_MILLIS,
1000); // 1 second by default

timelineEventsEnabled =
configProvider.getBoolean(
ProfilingConfig.PROFILING_TIMELINE_EVENTS_ENABLED,
Expand Down Expand Up @@ -3700,6 +3707,10 @@ public boolean isEnabled(
Collections.singletonList(settingName), "", settingSuffix, defaultEnabled);
}

public long getDependecyResolutionPeriodMillis() {
return dependecyResolutionPeriodMillis;
}

public boolean isDBMTracePreparedStatements() {
return DBMTracePreparedStatements;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package datadog.telemetry.dependency;

import datadog.trace.api.Config;
import datadog.trace.util.AgentTaskScheduler;
import java.lang.instrument.Instrumentation;
import java.net.URI;
Expand Down Expand Up @@ -31,7 +32,11 @@ public class DependencyService implements Runnable {
public void schedulePeriodicResolution() {
scheduledTask =
AgentTaskScheduler.INSTANCE.scheduleAtFixedRate(
AgentTaskScheduler.RunnableTask.INSTANCE, this, 0, 1000L, TimeUnit.MILLISECONDS);
AgentTaskScheduler.RunnableTask.INSTANCE,
this,
0,
Config.get().getDependecyResolutionPeriodMillis(),
TimeUnit.MILLISECONDS);
}

public void resolveOneDependency() {
Expand Down

0 comments on commit fd1f40f

Please sign in to comment.