Skip to content

[Debugger] Allow double interval for diagnostics uploads #8681

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public ProbeStatusSink(Config config, String diagnosticsEndpoint, boolean useMul
this.diagnosticUploader = diagnosticUploader;
this.useMultiPart = useMultiPart;
this.messageBuilder = new Builder(config);
this.interval = Duration.ofSeconds(config.getDynamicInstrumentationDiagnosticsInterval());
this.interval =
Duration.ofMillis((long) (config.getDynamicInstrumentationDiagnosticsInterval() * 1000));
this.batchSize = config.getDynamicInstrumentationUploadBatchSize();
this.queue = new ArrayBlockingQueue<>(2 * this.batchSize);
this.isInstrumentTheWorld = config.isDynamicInstrumentationInstrumentTheWorld();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class ProbeStatusSinkTest {
private static final ProbeId PROBE_ID_NEW_VERSION = new ProbeId(PROBE_ID.getId(), 21);
private static final ProbeId PROBE_ID2 = new ProbeId(UUID.randomUUID().toString(), 21);
private static final String MESSAGE = "Foo";
private static final int DIAGNOSTICS_INTERVAL = 60 * 60; // in seconds = 1h
private static final double DIAGNOSTICS_INTERVAL = 60 * 60; // in seconds = 1h
private static final Instant AFTER_INTERVAL_HAS_PASSED =
Instant.now().plus(Duration.ofSeconds(DIAGNOSTICS_INTERVAL + 5));
Instant.now().plus(Duration.ofSeconds((int) DIAGNOSTICS_INTERVAL + 5));
private static final Instant BEFORE_INTERVAL_HAS_PASSED =
Instant.now().plus(Duration.ofSeconds(DIAGNOSTICS_INTERVAL - 5));
Instant.now().plus(Duration.ofSeconds((int) DIAGNOSTICS_INTERVAL - 5));

@Mock private Config config;

Expand Down
6 changes: 3 additions & 3 deletions internal-api/src/main/java/datadog/trace/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public static String getHostName() {
private final int dynamicInstrumentationUploadFlushInterval;
private final boolean dynamicInstrumentationClassFileDumpEnabled;
private final int dynamicInstrumentationPollInterval;
private final int dynamicInstrumentationDiagnosticsInterval;
private final double dynamicInstrumentationDiagnosticsInterval;
private final boolean dynamicInstrumentationMetricEnabled;
private final String dynamicInstrumentationProbeFile;
private final int dynamicInstrumentationUploadBatchSize;
Expand Down Expand Up @@ -1653,7 +1653,7 @@ PROFILING_DATADOG_PROFILER_ENABLED, isDatadogProfilerSafeInCurrentEnvironment())
configProvider.getInteger(
DYNAMIC_INSTRUMENTATION_POLL_INTERVAL, DEFAULT_DYNAMIC_INSTRUMENTATION_POLL_INTERVAL);
dynamicInstrumentationDiagnosticsInterval =
configProvider.getInteger(
configProvider.getDouble(
DYNAMIC_INSTRUMENTATION_DIAGNOSTICS_INTERVAL,
DEFAULT_DYNAMIC_INSTRUMENTATION_DIAGNOSTICS_INTERVAL);
dynamicInstrumentationMetricEnabled =
Expand Down Expand Up @@ -3222,7 +3222,7 @@ public int getDynamicInstrumentationPollInterval() {
return dynamicInstrumentationPollInterval;
}

public int getDynamicInstrumentationDiagnosticsInterval() {
public double getDynamicInstrumentationDiagnosticsInterval() {
return dynamicInstrumentationDiagnosticsInterval;
}

Expand Down