From dc994834c23fca7e52a55168586ed1ab470b14b9 Mon Sep 17 00:00:00 2001
From: kananindzya
Date: Fri, 19 Jul 2019 15:23:53 +0600
Subject: [PATCH 01/10] make server_urls dynamically reloadable
---
.../co/elastic/apm/agent/report/ReporterConfiguration.java | 2 +-
docs/configuration.asciidoc | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
index 67108f167b..09b145983c 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
@@ -68,7 +68,7 @@ public class ReporterConfiguration extends ConfigurationOptionProvider {
"If outgoing HTTP traffic has to go through a proxy," +
"you can use the Java system properties `http.proxyHost` and `http.proxyPort` to set that up.\n" +
"See also [Java's proxy documentation](https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html) for more information.")
- .dynamic(false)
+ .dynamic(true)
.buildWithDefault(Collections.singletonList(UrlValueConverter.INSTANCE.convert("http://localhost:8200")));
private final ConfigurationOption serverTimeout = TimeDurationValueConverter.durationOption("s")
diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc
index 1754042c6a..55fa0d21c7 100644
--- a/docs/configuration.asciidoc
+++ b/docs/configuration.asciidoc
@@ -882,7 +882,7 @@ See also [Java's proxy documentation](https://docs.oracle.com/javase/8/docs/tech
[options="header"]
|============
| Default | Type | Dynamic
-| `http://localhost:8200` | List | false
+| `http://localhost:8200` | List | true
|============
@@ -1631,7 +1631,7 @@ The default unit for this option is `ms`
# If outgoing HTTP traffic has to go through a proxy,you can use the Java system properties `http.proxyHost` and `http.proxyPort` to set that up.
# See also [Java's proxy documentation](https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html) for more information.
#
-# This setting can not be changed at runtime. Changes require a restart of the application.
+# This setting can be changed at runtime
# Type: comma separated list
# Default value: http://localhost:8200
#
From 12845ec5d88447c5630c9eebd44d013af319af8a Mon Sep 17 00:00:00 2001
From: kananindzya
Date: Fri, 19 Jul 2019 16:23:44 +0600
Subject: [PATCH 02/10] added listener on properties change. Make serverUrls as
static and volatile.
---
.../elastic/apm/agent/report/ApmServerClient.java | 7 ++++++-
.../apm/agent/report/ReporterConfiguration.java | 14 ++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
index 6bde86883d..b452f1b638 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
@@ -64,7 +64,7 @@ public class ApmServerClient {
private static final Logger logger = LoggerFactory.getLogger(ApmServerClient.class);
private static final String USER_AGENT = "elasticapm-java/" + VersionUtils.getAgentVersion();
private final ReporterConfiguration reporterConfiguration;
- private final List serverUrls;
+ private static volatile List serverUrls;
private final AtomicInteger errorCount = new AtomicInteger();
public ApmServerClient(ReporterConfiguration reporterConfiguration) {
@@ -245,4 +245,9 @@ public interface ConnectionHandler {
T withConnection(HttpURLConnection connection) throws IOException;
}
+ public static synchronized void overrideApmServerUrls(List serverUrls) {
+ logger.debug("server_urls override with value = ({}).", serverUrls);
+ ApmServerClient.serverUrls = serverUrls;
+ }
+
}
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
index 09b145983c..526f40baf1 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
@@ -30,6 +30,7 @@
import co.elastic.apm.agent.configuration.converter.TimeDurationValueConverter;
import co.elastic.apm.agent.matcher.WildcardMatcher;
import co.elastic.apm.agent.matcher.WildcardMatcherValueConverter;
+import org.slf4j.event.Level;
import org.stagemonitor.configuration.ConfigurationOption;
import org.stagemonitor.configuration.ConfigurationOptionProvider;
import org.stagemonitor.configuration.converter.ListValueConverter;
@@ -69,6 +70,12 @@ public class ReporterConfiguration extends ConfigurationOptionProvider {
"you can use the Java system properties `http.proxyHost` and `http.proxyPort` to set that up.\n" +
"See also [Java's proxy documentation](https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html) for more information.")
.dynamic(true)
+ .addChangeListener(new ConfigurationOption.ChangeListener>() {
+ @Override
+ public void onChange(ConfigurationOption> configurationOption, List oldValue, List newValue) {
+ setApmServerUrls(newValue);
+ }
+ })
.buildWithDefault(Collections.singletonList(UrlValueConverter.INSTANCE.convert("http://localhost:8200")));
private final ConfigurationOption serverTimeout = TimeDurationValueConverter.durationOption("s")
@@ -210,4 +217,11 @@ public long getMetricsIntervalMs() {
public List getDisableMetrics() {
return disableMetrics.get();
}
+
+ private static void setApmServerUrls(@Nullable List serverUrls) {
+ if (serverUrls != null && !serverUrls.isEmpty()) {
+ ApmServerClient.overrideApmServerUrls(serverUrls);
+ }
+ }
+
}
From ab64e6650695aa3ac9d1f46ea7f91eb9f192fa17 Mon Sep 17 00:00:00 2001
From: kananindzya
Date: Fri, 19 Jul 2019 16:49:36 +0600
Subject: [PATCH 03/10] moved to consturoctor. added reseting of errorCount
---
.../apm/agent/report/ApmServerClient.java | 18 +++++++++++++++---
.../agent/report/ReporterConfiguration.java | 18 ++----------------
2 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
index b452f1b638..936076f264 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
@@ -27,6 +27,7 @@
import co.elastic.apm.agent.util.VersionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.stagemonitor.configuration.ConfigurationOption;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -64,7 +65,7 @@ public class ApmServerClient {
private static final Logger logger = LoggerFactory.getLogger(ApmServerClient.class);
private static final String USER_AGENT = "elasticapm-java/" + VersionUtils.getAgentVersion();
private final ReporterConfiguration reporterConfiguration;
- private static volatile List serverUrls;
+ private volatile List serverUrls;
private final AtomicInteger errorCount = new AtomicInteger();
public ApmServerClient(ReporterConfiguration reporterConfiguration) {
@@ -73,6 +74,16 @@ public ApmServerClient(ReporterConfiguration reporterConfiguration) {
public ApmServerClient(ReporterConfiguration reporterConfiguration, List serverUrls) {
this.reporterConfiguration = reporterConfiguration;
+ for (ConfigurationOption configurationOption : reporterConfiguration.getConfigurationOptions()) {
+ if ("server_urls".equals(configurationOption.getKey())) {
+ configurationOption.addChangeListener(new ConfigurationOption.ChangeListener>() {
+ @Override
+ public void onChange(ConfigurationOption> configurationOption, List oldValue, List newValue) {
+ overrideApmServerUrls(newValue);
+ }
+ });
+ }
+ }
this.serverUrls = Collections.unmodifiableList(serverUrls);
}
@@ -245,9 +256,10 @@ public interface ConnectionHandler {
T withConnection(HttpURLConnection connection) throws IOException;
}
- public static synchronized void overrideApmServerUrls(List serverUrls) {
+ public synchronized void overrideApmServerUrls(List serverUrls) {
logger.debug("server_urls override with value = ({}).", serverUrls);
- ApmServerClient.serverUrls = serverUrls;
+ this.serverUrls = serverUrls;
+ this.errorCount.set(0);
}
}
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
index 526f40baf1..4701674721 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
@@ -11,9 +11,9 @@
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -30,7 +30,6 @@
import co.elastic.apm.agent.configuration.converter.TimeDurationValueConverter;
import co.elastic.apm.agent.matcher.WildcardMatcher;
import co.elastic.apm.agent.matcher.WildcardMatcherValueConverter;
-import org.slf4j.event.Level;
import org.stagemonitor.configuration.ConfigurationOption;
import org.stagemonitor.configuration.ConfigurationOptionProvider;
import org.stagemonitor.configuration.converter.ListValueConverter;
@@ -70,12 +69,6 @@ public class ReporterConfiguration extends ConfigurationOptionProvider {
"you can use the Java system properties `http.proxyHost` and `http.proxyPort` to set that up.\n" +
"See also [Java's proxy documentation](https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html) for more information.")
.dynamic(true)
- .addChangeListener(new ConfigurationOption.ChangeListener>() {
- @Override
- public void onChange(ConfigurationOption> configurationOption, List oldValue, List newValue) {
- setApmServerUrls(newValue);
- }
- })
.buildWithDefault(Collections.singletonList(UrlValueConverter.INSTANCE.convert("http://localhost:8200")));
private final ConfigurationOption serverTimeout = TimeDurationValueConverter.durationOption("s")
@@ -217,11 +210,4 @@ public long getMetricsIntervalMs() {
public List getDisableMetrics() {
return disableMetrics.get();
}
-
- private static void setApmServerUrls(@Nullable List serverUrls) {
- if (serverUrls != null && !serverUrls.isEmpty()) {
- ApmServerClient.overrideApmServerUrls(serverUrls);
- }
- }
-
}
From b71827b58f8c4df4e65410b19e686da74f7fde4e Mon Sep 17 00:00:00 2001
From: kananindzya
Date: Fri, 19 Jul 2019 17:58:01 +0600
Subject: [PATCH 04/10] fixed according to comments
---
.../apm/agent/report/ApmServerClient.java | 34 ++++++++-----------
.../agent/report/ReporterConfiguration.java | 5 +++
2 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
index 936076f264..7db690e7b9 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
@@ -69,26 +69,25 @@ public class ApmServerClient {
private final AtomicInteger errorCount = new AtomicInteger();
public ApmServerClient(ReporterConfiguration reporterConfiguration) {
- this(reporterConfiguration, shuffleUrls(reporterConfiguration));
+ this(reporterConfiguration, shuffleUrls(reporterConfiguration.getServerUrls()));
}
- public ApmServerClient(ReporterConfiguration reporterConfiguration, List serverUrls) {
+ public ApmServerClient(ReporterConfiguration reporterConfiguration, List shuffledUrls) {
this.reporterConfiguration = reporterConfiguration;
- for (ConfigurationOption configurationOption : reporterConfiguration.getConfigurationOptions()) {
- if ("server_urls".equals(configurationOption.getKey())) {
- configurationOption.addChangeListener(new ConfigurationOption.ChangeListener>() {
- @Override
- public void onChange(ConfigurationOption> configurationOption, List oldValue, List newValue) {
- overrideApmServerUrls(newValue);
- }
- });
+ this.reporterConfiguration.getServerUrlsOption().addChangeListener(new ConfigurationOption.ChangeListener>() {
+ @Override
+ public void onChange(ConfigurationOption> configurationOption, List oldValue, List newValue) {
+ logger.debug("server_urls override with value = ({}).", newValue);
+ if (newValue != null && !newValue.isEmpty()) {
+ serverUrls = shuffleUrls(newValue);
+ errorCount.set(0);
+ }
}
- }
- this.serverUrls = Collections.unmodifiableList(serverUrls);
+ });
+ this.serverUrls = Collections.unmodifiableList(shuffledUrls);
}
- private static List shuffleUrls(ReporterConfiguration reporterConfiguration) {
- List serverUrls = new ArrayList<>(reporterConfiguration.getServerUrls());
+ private static List shuffleUrls(List serverUrls) {
// shuffling the URL list helps to distribute the load across the apm servers
// when there are multiple agents, they should not all start connecting to the same apm server
Collections.shuffle(serverUrls);
@@ -151,6 +150,7 @@ private URL appendPath(URL serverUrl, String apmServerPath) throws MalformedURLE
* the error count is not incremented.
* This avoids concurrent requests from incrementing the error multiple times due to only one failing server.
*
+ *
* @param expectedErrorCount the error count that is expected by the current thread
* @return the new expected error count
*/
@@ -256,10 +256,4 @@ public interface ConnectionHandler {
T withConnection(HttpURLConnection connection) throws IOException;
}
- public synchronized void overrideApmServerUrls(List serverUrls) {
- logger.debug("server_urls override with value = ({}).", serverUrls);
- this.serverUrls = serverUrls;
- this.errorCount.set(0);
- }
-
}
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
index 4701674721..abdd17623c 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
@@ -210,4 +210,9 @@ public long getMetricsIntervalMs() {
public List getDisableMetrics() {
return disableMetrics.get();
}
+
+ public ConfigurationOption> getServerUrlsOption() {
+ return this.serverUrl;
+ }
+
}
From 281187341bb05347ad99f5b8badc7bc072513132 Mon Sep 17 00:00:00 2001
From: kananindzya
Date: Fri, 19 Jul 2019 18:14:02 +0600
Subject: [PATCH 05/10] added feature to changelog
---
CHANGELOG.md | 1 +
.../java/co/elastic/apm/agent/report/ReporterConfiguration.java | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 863b1619ac..b7f55a5f1d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
## Features
* Add support for Spring's JMS flavor - instrumenting `org.springframework.jms.listener.SessionAwareMessageListener`
+ * Added support for setting `server_urls` dynamically via properties file [#723](https://github.com/elastic/apm-agent-java/issues/723)
## Bug Fixes
* Some JMS Consumers and Producers are filtered due to class name filtering in instrumentation matching
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
index abdd17623c..c2a67866b5 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ReporterConfiguration.java
@@ -214,5 +214,5 @@ public List getDisableMetrics() {
public ConfigurationOption> getServerUrlsOption() {
return this.serverUrl;
}
-
+
}
From 35491ea4d7d009145d92d8c6fa672a065c6a5b80 Mon Sep 17 00:00:00 2001
From: kananindzya
Date: Mon, 22 Jul 2019 17:01:30 +0600
Subject: [PATCH 06/10] added test for checking dynamic change of server_urls
---
.../apm/agent/report/ApmServerClient.java | 4 ++
.../apm/agent/report/ApmServerClientTest.java | 41 +++++++++++++++++--
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
index 7db690e7b9..4926008437 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
@@ -251,6 +251,10 @@ int getErrorCount() {
return errorCount.get();
}
+ protected List getServerUrls() {
+ return this.serverUrls;
+ }
+
public interface ConnectionHandler {
@Nullable
T withConnection(HttpURLConnection connection) throws IOException;
diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
index e01c412ebc..5a43d04d55 100644
--- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
+++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
@@ -24,18 +24,30 @@
*/
package co.elastic.apm.agent.report;
+import co.elastic.apm.agent.configuration.SpyConfiguration;
+import co.elastic.apm.agent.impl.ElasticApmTracer;
+import co.elastic.apm.agent.impl.ElasticApmTracerBuilder;
+import co.elastic.apm.agent.logging.LoggingConfiguration;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+import org.mockito.Mockito;
+import org.stagemonitor.configuration.ConfigurationOptionProvider;
+import org.stagemonitor.configuration.ConfigurationRegistry;
+import org.stagemonitor.configuration.source.SimpleSource;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import java.util.Arrays;
import java.util.List;
+import java.util.ServiceLoader;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
@@ -52,17 +64,28 @@ public class ApmServerClientTest {
@Rule
public WireMockRule apmServer2 = new WireMockRule(WireMockConfiguration.wireMockConfig().dynamicPort());
private ApmServerClient apmServerClient;
+ protected static ConfigurationRegistry config;
+ private ElasticApmTracer tracer;
+ private ReporterConfiguration reporterConfiguration;
@Before
public void setUp() throws MalformedURLException {
+ System.out.println("BEFORE");
+ URL url1 = new URL("http", "localhost", apmServer1.port(), "/");
+ URL url2 = new URL("http", "localhost", apmServer2.port(), "/");
+ config = SpyConfiguration.createSpyConfig();
+ tracer = new ElasticApmTracerBuilder()
+ .configurationRegistry(config)
+ .build();
+ reporterConfiguration = tracer.getConfig(ReporterConfiguration.class);
+
+ Mockito.when(reporterConfiguration.getServerUrls()).thenReturn(Arrays.asList(url1, url2));
+
apmServer1.stubFor(get(urlEqualTo("/test")).willReturn(notFound()));
apmServer1.stubFor(get(urlEqualTo("/not-found")).willReturn(notFound()));
apmServer2.stubFor(get(urlEqualTo("/test")).willReturn(ok("hello from server 2")));
apmServer2.stubFor(get(urlEqualTo("/not-found")).willReturn(notFound()));
- apmServerClient = new ApmServerClient(new ReporterConfiguration(), List.of(
- new URL("http", "localhost", apmServer1.port(), "/"),
- new URL("http", "localhost", apmServer2.port(), "/")
- ));
+ apmServerClient = new ApmServerClient(reporterConfiguration, tracer.getConfig(ReporterConfiguration.class).getServerUrls());
}
@Test
@@ -148,4 +171,14 @@ public void testSimulateConcurrentConnectionError() {
apmServerClient.incrementAndGetErrorCount(0);
assertThat(apmServerClient.getErrorCount()).isOne();
}
+
+ @Test
+ public void testGetServerUrlsVerifyThatServerUrlsWillBeReloaded() throws IOException {
+ URL tempUrl = new URL("http", "localhost", 9999, "");
+ config.save("server_urls", tempUrl.toString(), SpyConfiguration.CONFIG_SOURCE_NAME);
+
+ List updatedServerUrls = apmServerClient.getServerUrls();
+
+ assertThat(updatedServerUrls).isEqualTo(Arrays.asList(tempUrl));
+ }
}
From 75fc77f1e0644aa47bd41158661acd0eedf3dcf2 Mon Sep 17 00:00:00 2001
From: kananindzya
Date: Mon, 22 Jul 2019 17:16:09 +0600
Subject: [PATCH 07/10] delete sout
---
.../java/co/elastic/apm/agent/report/ApmServerClientTest.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
index 5a43d04d55..b3d23ecab1 100644
--- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
+++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
@@ -70,7 +70,6 @@ public class ApmServerClientTest {
@Before
public void setUp() throws MalformedURLException {
- System.out.println("BEFORE");
URL url1 = new URL("http", "localhost", apmServer1.port(), "/");
URL url2 = new URL("http", "localhost", apmServer2.port(), "/");
config = SpyConfiguration.createSpyConfig();
From f2df153caf5c5bf358236244dca54f8c6f1992ed Mon Sep 17 00:00:00 2001
From: kananindzya <48118512+kananindzya@users.noreply.github.com>
Date: Mon, 22 Jul 2019 17:50:25 +0600
Subject: [PATCH 08/10] Update
apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
Co-Authored-By: eyalkoren <41850454+eyalkoren@users.noreply.github.com>
---
.../java/co/elastic/apm/agent/report/ApmServerClientTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
index b3d23ecab1..d39c061c3a 100644
--- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
+++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
@@ -64,7 +64,7 @@ public class ApmServerClientTest {
@Rule
public WireMockRule apmServer2 = new WireMockRule(WireMockConfiguration.wireMockConfig().dynamicPort());
private ApmServerClient apmServerClient;
- protected static ConfigurationRegistry config;
+ private ConfigurationRegistry config;
private ElasticApmTracer tracer;
private ReporterConfiguration reporterConfiguration;
From 0856c564d52ff704d9063746c0528d6253d15d97 Mon Sep 17 00:00:00 2001
From: kananindzya <48118512+kananindzya@users.noreply.github.com>
Date: Mon, 22 Jul 2019 17:50:33 +0600
Subject: [PATCH 09/10] Update
apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
Co-Authored-By: eyalkoren <41850454+eyalkoren@users.noreply.github.com>
---
.../main/java/co/elastic/apm/agent/report/ApmServerClient.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
index 4926008437..8616b5c705 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
@@ -251,7 +251,7 @@ int getErrorCount() {
return errorCount.get();
}
- protected List getServerUrls() {
+ List getServerUrls() {
return this.serverUrls;
}
From a2313f59550af7204451ce4ca6240b911b8f142f Mon Sep 17 00:00:00 2001
From: kananindzya
Date: Mon, 22 Jul 2019 17:54:20 +0600
Subject: [PATCH 10/10] fix according to comments
---
.../co/elastic/apm/agent/report/ApmServerClient.java | 2 +-
.../co/elastic/apm/agent/report/ApmServerClientTest.java | 9 ++-------
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
index 8616b5c705..955da32deb 100644
--- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
+++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/ApmServerClient.java
@@ -251,7 +251,7 @@ int getErrorCount() {
return errorCount.get();
}
- List getServerUrls() {
+ List getServerUrls() {
return this.serverUrls;
}
diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
index d39c061c3a..118efc86bf 100644
--- a/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
+++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/report/ApmServerClientTest.java
@@ -11,9 +11,9 @@
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -27,17 +27,13 @@
import co.elastic.apm.agent.configuration.SpyConfiguration;
import co.elastic.apm.agent.impl.ElasticApmTracer;
import co.elastic.apm.agent.impl.ElasticApmTracerBuilder;
-import co.elastic.apm.agent.logging.LoggingConfiguration;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.Mockito;
-import org.stagemonitor.configuration.ConfigurationOptionProvider;
import org.stagemonitor.configuration.ConfigurationRegistry;
-import org.stagemonitor.configuration.source.SimpleSource;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -47,7 +43,6 @@
import java.net.URLConnection;
import java.util.Arrays;
import java.util.List;
-import java.util.ServiceLoader;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;