Skip to content
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 @@ -76,6 +76,7 @@ public class DDAgentFeaturesDiscovery implements DroppingPolicy {
private final String[] metricsEndpoints = {V06_METRICS_ENDPOINT};
private final String[] configEndpoints = {V07_CONFIG_ENDPOINT};
private final boolean metricsEnabled;
private final boolean ignoreAgentVersionForStats;
private final String[] dataStreamsEndpoints = {V01_DATASTREAMS_ENDPOINT};
// ordered from most recent to least recent, as the logic will stick with the first one that is
// available
Expand Down Expand Up @@ -108,10 +109,12 @@ public DDAgentFeaturesDiscovery(
Monitoring monitoring,
HttpUrl agentUrl,
boolean enableV05Traces,
boolean metricsEnabled) {
boolean metricsEnabled,
boolean ignoreAgentVersionForStats) {
this.client = client;
this.agentBaseUrl = agentUrl;
this.metricsEnabled = metricsEnabled;
this.ignoreAgentVersionForStats = ignoreAgentVersionForStats;
this.traceEndpoints =
enableV05Traces
? new String[] {V05_ENDPOINT, V04_ENDPOINT, V03_ENDPOINT}
Expand Down Expand Up @@ -301,7 +304,9 @@ private boolean processInfoResponse(State newState, String response) {
|| Boolean.TRUE.equals(canDrop));

newState.supportsClientSideStats =
newState.supportsDropping && !AgentVersion.isVersionBelow(newState.version, 7, 65, 0);
newState.supportsDropping
&& (ignoreAgentVersionForStats
|| !AgentVersion.isVersionBelow(newState.version, 7, 65, 0));

Object peer_tags = map.get("peer_tags");
newState.peerTags =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ public DDAgentFeaturesDiscovery featuresDiscovery(Config config) {
monitoring,
agentUrl,
config.isTraceAgentV05Enabled(),
config.isTracerMetricsEnabled());
config.isTracerMetricsEnabled(),
config.isTracerMetricsIgnoreAgentVersion());

if (paused) {
// defer remote discovery until remote I/O is allowed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test parse /info response"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, v05Enabled, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, v05Enabled, true, false)

when: "/info available"
features.discover()
Expand Down Expand Up @@ -85,7 +85,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "Should change discovery state atomically after discovery happened"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info available"
features.discover()
Expand All @@ -111,7 +111,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test parse /info response with discoverIfOutdated"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info available"
features.discoverIfOutdated()
Expand Down Expand Up @@ -139,7 +139,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test parse /info response with client dropping"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info available"
features.discover()
Expand All @@ -157,7 +157,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test parse /info response with data streams unavailable"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info available"
features.discover()
Expand All @@ -176,7 +176,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test parse /info response with long running spans available"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info available"
features.discover()
Expand All @@ -190,7 +190,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test fallback when /info empty"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true, false)

when: "/info is empty"
features.discover()
Expand All @@ -212,7 +212,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test fallback when /info not found"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info unavailable"
features.discover()
Expand All @@ -234,7 +234,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test fallback when /info not found and agent returns ok"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info unavailable"
features.discover()
Expand All @@ -254,7 +254,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test fallback when /info not found and v0.5 disabled"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true, false)

when: "/info unavailable"
features.discover()
Expand All @@ -275,7 +275,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test fallback when /info not found and v0.5 unavailable agent side"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info unavailable"
features.discover()
Expand All @@ -296,7 +296,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test fallback on very old agent"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info unavailable"
features.discover()
Expand All @@ -318,7 +318,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "disabling metrics disables metrics and dropping"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, false)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, false, false)

when: "/info unavailable"
features.discover()
Expand Down Expand Up @@ -354,7 +354,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "discovery of metrics endpoint after agent upgrade enables dropping and metrics"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true, false)

when: "/info unavailable"
features.discover()
Expand Down Expand Up @@ -382,7 +382,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "disappearance of info endpoint after agent downgrade disables metrics and dropping"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true, false)

when: "/info available"
features.discover()
Expand Down Expand Up @@ -411,7 +411,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "disappearance of metrics endpoint after agent downgrade disables metrics and dropping"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, false, true, false)

when: "/info available"
features.discover()
Expand Down Expand Up @@ -441,7 +441,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test parse /info response with telemetry proxy"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info available"
features.discover()
Expand All @@ -458,7 +458,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test parse /info response with old EVP proxy"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info available"
features.discover()
Expand All @@ -477,7 +477,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test parse /info response with peer tag back propagation"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "/info available"
features.discover()
Expand Down Expand Up @@ -510,7 +510,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test metrics disabled for agent version below 7.65"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "agent version is below 7.65"
features.discover()
Expand Down Expand Up @@ -544,7 +544,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "test metrics disabled for agent with unparseable version"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)

when: "agent version is unparseable"
features.discover()
Expand All @@ -570,7 +570,7 @@ class DDAgentFeaturesDiscoveryTest extends DDSpecification {
def "should send container id as header on the info request and parse the hash in the response"() {
setup:
OkHttpClient client = Mock(OkHttpClient)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery features = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)
def oldContainerId = ContainerInfo.get().getContainerId()
def oldContainerTagsHash = ContainerInfo.get().getContainerTagsHash()
ContainerInfo.get().setContainerId("test")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ public Call clone() {

static class StubDDAgentFeaturesDiscovery extends DDAgentFeaturesDiscovery {
public StubDDAgentFeaturesDiscovery(OkHttpClient client) {
super(client, Monitoring.DISABLED, HttpUrl.get("http://localhost:8080/"), false, false);
super(
client, Monitoring.DISABLED, HttpUrl.get("http://localhost:8080/"), false, false, false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ abstract class InstrumentationSpecification extends DDSpecification implements A
// emit traces to the APM Test-Agent for Cross-Tracer Testing Trace Checks
HttpUrl agentUrl = HttpUrl.get("http://" + agentHost + ":" + DEFAULT_TRACE_AGENT_PORT)
OkHttpClient client = buildHttpClient(true, null, null, TimeUnit.SECONDS.toMillis(DEFAULT_AGENT_TIMEOUT))
DDAgentFeaturesDiscovery featureDiscovery = new DDAgentFeaturesDiscovery(client, Monitoring.DISABLED, agentUrl, Config.get().isTraceAgentV05Enabled(), Config.get().isTracerMetricsEnabled())
DDAgentFeaturesDiscovery featureDiscovery = new DDAgentFeaturesDiscovery(client, Monitoring.DISABLED, agentUrl, Config.get().isTraceAgentV05Enabled(), Config.get().isTracerMetricsEnabled(), Config.get().isTracerMetricsIgnoreAgentVersion())
TEST_AGENT_API = new DDAgentApi(client, agentUrl, featureDiscovery, Monitoring.DISABLED, Config.get().isTracerMetricsEnabled())
TEST_AGENT_WRITER = DDAgentWriter.builder().agentApi(TEST_AGENT_API).build()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class MockFeaturesDiscovery extends DDAgentFeaturesDiscovery {
private final boolean supportsDataStreams;

public MockFeaturesDiscovery(boolean supportsDataStreams) {
super(null, Monitoring.DISABLED, null, true, true);
super(null, Monitoring.DISABLED, null, true, true, false);
this.supportsDataStreams = supportsDataStreams;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public final class GeneralConfig {
public static final String PERF_METRICS_ENABLED = "trace.perf.metrics.enabled";

public static final String TRACE_STATS_COMPUTATION_ENABLED = "trace.stats.computation.enabled";
public static final String TRACE_STATS_COMPUTATION_IGNORE_AGENT_VERSION =
"trace.stats.computation.ignore.agent.version";
public static final String TRACER_METRICS_ENABLED = "trace.tracer.metrics.enabled";
public static final String TRACER_METRICS_BUFFERING_ENABLED =
"trace.tracer.metrics.buffering.enabled";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static class FixedAgentFeaturesDiscovery extends DDAgentFeaturesDiscovery {

public FixedAgentFeaturesDiscovery(Set<String> peerTags, Set<String> spanKinds) {
// create a fixed discovery with metrics enabled
super(null, Monitoring.DISABLED, null, false, true);
super(null, Monitoring.DISABLED, null, false, true, false);
this.peerTags = peerTags;
this.spanKinds = spanKinds;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static class DDAgentWriterBuilder {
Monitoring monitoring = Monitoring.DISABLED;
boolean traceAgentV05Enabled = Config.get().isTraceAgentV05Enabled();
boolean metricsReportingEnabled = Config.get().isTracerMetricsEnabled();
boolean metricsIgnoreAgentVersion = Config.get().isTracerMetricsIgnoreAgentVersion();
private int flushTimeout = 1;
private TimeUnit flushTimeoutUnit = TimeUnit.SECONDS;
boolean alwaysFlush = false;
Expand Down Expand Up @@ -113,6 +114,11 @@ public DDAgentWriterBuilder metricsReportingEnabled(boolean metricsReportingEnab
return this;
}

public DDAgentWriterBuilder metricsIgnoreAgentVersion(boolean metricsIgnoreAgentVersion) {
this.metricsIgnoreAgentVersion = metricsIgnoreAgentVersion;
return this;
}

public DDAgentWriterBuilder featureDiscovery(DDAgentFeaturesDiscovery featureDiscovery) {
this.featureDiscovery = featureDiscovery;
return this;
Expand Down Expand Up @@ -143,7 +149,12 @@ public DDAgentWriter build() {
if (null == featureDiscovery) {
featureDiscovery =
new DDAgentFeaturesDiscovery(
client, monitoring, agentUrl, traceAgentV05Enabled, metricsReportingEnabled);
client,
monitoring,
agentUrl,
traceAgentV05Enabled,
metricsReportingEnabled,
metricsIgnoreAgentVersion);
}
if (null == agentApi) {
agentApi =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class TracerConnectionReliabilityTest extends DDSpecification {

class FixedTraceEndpointFeaturesDiscovery extends DDAgentFeaturesDiscovery {
FixedTraceEndpointFeaturesDiscovery(SharedCommunicationObjects objects) {
super(objects.agentHttpClient, Monitoring.DISABLED, objects.agentUrl, false, false)
super(objects.agentHttpClient, Monitoring.DISABLED, objects.agentUrl, false, false, false)
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ class DDAgentApiTest extends DDCoreSpecification {
def createAgentApi(String url) {
HttpUrl agentUrl = HttpUrl.get(url)
OkHttpClient client = OkHttpUtils.buildHttpClient(agentUrl, 1000)
DDAgentFeaturesDiscovery discovery = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
DDAgentFeaturesDiscovery discovery = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)
return [discovery, new DDAgentApi(client, agentUrl, discovery, monitoring, false)]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class DDAgentWriterCombinedTest extends DDCoreSpecification {
}
def agentUrl = HttpUrl.get(agent.address)
def client = OkHttpUtils.buildHttpClient(agentUrl, 1000)
def discovery = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
def discovery = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)
def api = new DDAgentApi(client, agentUrl, discovery, monitoring, true)
def writer = DDAgentWriter.builder()
.featureDiscovery(discovery)
Expand Down Expand Up @@ -380,7 +380,7 @@ class DDAgentWriterCombinedTest extends DDCoreSpecification {
}
def agentUrl = HttpUrl.get(agent.address)
def client = OkHttpUtils.buildHttpClient(agentUrl, 1000)
def discovery = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true)
def discovery = new DDAgentFeaturesDiscovery(client, monitoring, agentUrl, true, true, false)
def api = new DDAgentApi(client, agentUrl, discovery, monitoring, true)
def writer = DDAgentWriter.builder()
.featureDiscovery(discovery)
Expand Down
Loading
Loading