diff --git a/agent-module/agent-testweb/cassandra3-plugin-testweb/src/test/java/com/pinpoint/test/plugin/cassandra/CassandraTest.java b/agent-module/agent-testweb/cassandra3-plugin-testweb/src/test/java/com/pinpoint/test/plugin/cassandra/CassandraTest.java index 2fbaced11c30..1f3191961ed9 100644 --- a/agent-module/agent-testweb/cassandra3-plugin-testweb/src/test/java/com/pinpoint/test/plugin/cassandra/CassandraTest.java +++ b/agent-module/agent-testweb/cassandra3-plugin-testweb/src/test/java/com/pinpoint/test/plugin/cassandra/CassandraTest.java @@ -16,8 +16,8 @@ package com.pinpoint.test.plugin.cassandra; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.AutoClose; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.testcontainers.DockerClientFactory; @@ -27,6 +27,7 @@ public class CassandraTest { + @AutoClose private static CassandraContainer container; @BeforeAll @@ -38,23 +39,15 @@ public static void beforeClass() { container.getLocalDatacenter(); InetSocketAddress contactPoint = container.getContactPoint(); - final int port = contactPoint.getPort(); - System.out.println("##host=" + container.getHost()); - System.out.println("##port=" + port); + System.out.println("##contactPoint=" + contactPoint); System.out.println("##LocalDatacenter=" + container.getLocalDatacenter()); System.out.println("##user=" + container.getUsername()); System.out.println("##password=" + container.getPassword()); } - @AfterAll - public static void afterClass() { - if (container != null) { - container.stop(); - } - } @Test - public void test() throws Exception { - System.out.println("TEST"); + public void test() { + System.out.println("TEST " + container.getContactPoint()); } } \ No newline at end of file diff --git a/agent-module/agent-testweb/cassandra4-plugin-testweb/src/test/java/com/pinpoint/test/plugin/cassandra/CassandraTest.java b/agent-module/agent-testweb/cassandra4-plugin-testweb/src/test/java/com/pinpoint/test/plugin/cassandra/CassandraTest.java index 83596a3c4a96..fa4c371546b8 100644 --- a/agent-module/agent-testweb/cassandra4-plugin-testweb/src/test/java/com/pinpoint/test/plugin/cassandra/CassandraTest.java +++ b/agent-module/agent-testweb/cassandra4-plugin-testweb/src/test/java/com/pinpoint/test/plugin/cassandra/CassandraTest.java @@ -17,44 +17,40 @@ package com.pinpoint.test.plugin.cassandra; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.AutoClose; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.testcontainers.DockerClientFactory; -import org.testcontainers.containers.CassandraContainer; +import org.testcontainers.cassandra.CassandraContainer; + +import java.net.InetSocketAddress; public class CassandraTest { - private static CassandraContainer container; + @AutoClose + private static CassandraContainer container; @BeforeAll public static void beforeClass() { Assumptions.assumeTrue(DockerClientFactory.instance().isDockerAvailable(), "Docker not enabled"); - container = new CassandraContainer<>("cassandra:3.11.6"); + container = new CassandraContainer("cassandra:3.11.6"); container.start(); container.getLocalDatacenter(); - final Integer port = container.getMappedPort(CassandraContainer.CQL_PORT); - System.out.println("##host=" + container.getHost()); - System.out.println("##port=" + port.toString()); + InetSocketAddress contactPoint = container.getContactPoint(); + System.out.println("##contactPoint=" + contactPoint); System.out.println("##LocalDatacenter=" + container.getLocalDatacenter()); System.out.println("##user=" + container.getUsername()); System.out.println("##password=" + container.getPassword()); } - @AfterAll - public static void afterClass() { - if (container != null) { - container.stop(); - } - } @Test - public void test() throws Exception { - System.out.println("TEST"); + public void test() { + System.out.println("TEST " + container.getContactPoint()); } } \ No newline at end of file diff --git a/agent-module/plugins-it/activemq-it/activemq-5-15-it/src/test/java/com/navercorp/pinpoint/it/plugin/activemq/client/ActiveMQClientITBase.java b/agent-module/plugins-it/activemq-it/activemq-5-15-it/src/test/java/com/navercorp/pinpoint/it/plugin/activemq/client/ActiveMQClientITBase.java index 03f2cf410306..00226baed53f 100644 --- a/agent-module/plugins-it/activemq-it/activemq-5-15-it/src/test/java/com/navercorp/pinpoint/it/plugin/activemq/client/ActiveMQClientITBase.java +++ b/agent-module/plugins-it/activemq-it/activemq-5-15-it/src/test/java/com/navercorp/pinpoint/it/plugin/activemq/client/ActiveMQClientITBase.java @@ -117,7 +117,7 @@ public void run() { verifyConsumerConsumeEvent(verifier, testQueue, consumerSession); // Separate transaction for the consumer's request to receive the message - verifier.verifyTrace(root(STAND_ALONE, "Entry Point Process", null, null, null, null)); + verifier.verifyTrace(root(STAND_ALONE, "Entry Point Process", null, null, null)); Method receiveMessageMethod = MessageReceiver.class.getDeclaredMethod("receiveMessage", long.class); verifier.verifyTrace(event(INTERNAL_METHOD, receiveMessageMethod)); Method receiveMethod = ActiveMQMessageConsumer.class.getDeclaredMethod("receive", long.class); @@ -293,7 +293,7 @@ public void run() { Method printMessageMethod = MessagePrinter.class.getDeclaredMethod("printMessage", Message.class); for (int i = 0; i < 2; ++i) { verifier.verifyDiscreteTrace( - root(STAND_ALONE, "Entry Point Process", null, null, null, null), + root(STAND_ALONE, "Entry Point Process", null, null, null), event(INTERNAL_METHOD, receiveMessageMethod), event(ACTIVEMQ_CLIENT_INTERNAL, receiveMethod, annotation("activemq.message", getMessageAsString(expectedTextMessage))), event(INTERNAL_METHOD, printMessageMethod)); diff --git a/agent-module/plugins-it/activemq-it/activemq-5-17-it/src/test/java/com/navercorp/pinpoint/it/plugin/activemq/client/ActiveMQClientITBase.java b/agent-module/plugins-it/activemq-it/activemq-5-17-it/src/test/java/com/navercorp/pinpoint/it/plugin/activemq/client/ActiveMQClientITBase.java index 1c895eaafca7..86cf309455b3 100644 --- a/agent-module/plugins-it/activemq-it/activemq-5-17-it/src/test/java/com/navercorp/pinpoint/it/plugin/activemq/client/ActiveMQClientITBase.java +++ b/agent-module/plugins-it/activemq-it/activemq-5-17-it/src/test/java/com/navercorp/pinpoint/it/plugin/activemq/client/ActiveMQClientITBase.java @@ -115,7 +115,7 @@ public void run() { verifyConsumerConsumeEvent(verifier, testQueue, consumerSession); // Separate transaction for the consumer's request to receive the message - verifier.verifyTrace(root(STAND_ALONE, "Entry Point Process", null, null, null, null)); + verifier.verifyTrace(root(STAND_ALONE, "Entry Point Process", null, null, null)); Method receiveMessageMethod = MessageReceiver.class.getDeclaredMethod("receiveMessage", long.class); verifier.verifyTrace(event(INTERNAL_METHOD, receiveMessageMethod)); Method receiveMethod = ActiveMQMessageConsumer.class.getDeclaredMethod("receive", long.class); @@ -288,7 +288,7 @@ public void run() { Method printMessageMethod = MessagePrinter.class.getDeclaredMethod("printMessage", Message.class); for (int i = 0; i < 2; ++i) { verifier.verifyDiscreteTrace( - root(STAND_ALONE, "Entry Point Process", null, null, null, null), + root(STAND_ALONE, "Entry Point Process", null, null, null), event(INTERNAL_METHOD, receiveMessageMethod), event(ACTIVEMQ_CLIENT_INTERNAL, receiveMethod, annotation("activemq.message", getMessageAsString(expectedTextMessage))), event(INTERNAL_METHOD, printMessageMethod)); @@ -475,7 +475,7 @@ protected final void assertNoConsumerError(Exception consumerException) { } protected final void assertNoConsumerError(CompletableFuture consumerException) { - Exception exception = null; + Throwable exception = null; try { TextMessage message = (TextMessage) consumerException.get(1000, TimeUnit.MILLISECONDS); System.out.println("Received message : " + message.getText()); @@ -483,7 +483,7 @@ protected final void assertNoConsumerError(CompletableFuture consumerEx Thread.currentThread().interrupt(); exception = e; } catch (Throwable th) { - exception = (Exception) th; + exception = th; } Assertions.assertNull(exception, "Failed with exception : " + exception); } diff --git a/agent-module/plugins-it/cassandra-it/cassandra-2-it/src/test/java/com/navercorp/pinpoint/it/plugin/cassandra/CassandraServer.java b/agent-module/plugins-it/cassandra-it/cassandra-2-it/src/test/java/com/navercorp/pinpoint/it/plugin/cassandra/CassandraServer.java index 00a5d392c45e..f6a0cb3e3591 100644 --- a/agent-module/plugins-it/cassandra-it/cassandra-2-it/src/test/java/com/navercorp/pinpoint/it/plugin/cassandra/CassandraServer.java +++ b/agent-module/plugins-it/cassandra-it/cassandra-2-it/src/test/java/com/navercorp/pinpoint/it/plugin/cassandra/CassandraServer.java @@ -32,7 +32,7 @@ public Properties beforeAll() { cassandra.start(); InetSocketAddress contactPoint = cassandra.getContactPoint(); - try (Cluster cluster = newCluster("127.0.0.1", contactPoint.getPort())) { + try (Cluster cluster = newCluster(contactPoint.getHostName(), contactPoint.getPort())) { init(cluster); } diff --git a/agent-module/plugins-it/clickhouse-jdbc-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/clickhouse/ClickHouseITBase.java b/agent-module/plugins-it/clickhouse-jdbc-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/clickhouse/ClickHouseITBase.java index 7b7cf1e0cac9..3dd143b7cdbb 100644 --- a/agent-module/plugins-it/clickhouse-jdbc-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/clickhouse/ClickHouseITBase.java +++ b/agent-module/plugins-it/clickhouse-jdbc-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/clickhouse/ClickHouseITBase.java @@ -90,7 +90,7 @@ public void setup( this.jdbcApi = jdbcApi; try { - Driver driver = jdbcDriverClass.getDriver().newInstance(); + Driver driver = jdbcDriverClass.getDriver().getConstructor().newInstance(); DriverManager.registerDriver(driver); } catch (Exception e) { throw new RuntimeException("driver register error", e); diff --git a/agent-module/plugins-it/gson-it/src/test/java/com/navercorp/pinpoint/it/plugin/gson/GsonIT.java b/agent-module/plugins-it/gson-it/src/test/java/com/navercorp/pinpoint/it/plugin/gson/GsonIT.java index 0b126230ee54..e455b6c5c73b 100644 --- a/agent-module/plugins-it/gson-it/src/test/java/com/navercorp/pinpoint/it/plugin/gson/GsonIT.java +++ b/agent-module/plugins-it/gson-it/src/test/java/com/navercorp/pinpoint/it/plugin/gson/GsonIT.java @@ -208,6 +208,6 @@ public void testFromV1_6() throws Exception { } private JsonElement getParseElements() { - return new JsonParser().parse(json); + return JsonParser.parseString(json); } } diff --git a/agent-module/plugins-it/hbase-it/src/test/java/com/navercorp/pinpoint/it/plugin/hbase/HbaseClientIT.java b/agent-module/plugins-it/hbase-it/src/test/java/com/navercorp/pinpoint/it/plugin/hbase/HbaseClientIT.java index c3afcf8c3455..de95af682615 100644 --- a/agent-module/plugins-it/hbase-it/src/test/java/com/navercorp/pinpoint/it/plugin/hbase/HbaseClientIT.java +++ b/agent-module/plugins-it/hbase-it/src/test/java/com/navercorp/pinpoint/it/plugin/hbase/HbaseClientIT.java @@ -69,6 +69,7 @@ public void after() throws Exception { } @Test + @SuppressWarnings("deprecation") public void testAdmin() throws Exception { doReturn(new Configuration()).when(connection).getConfiguration(); @@ -92,6 +93,7 @@ public void testAdmin() throws Exception { } @Test + @SuppressWarnings("deprecation") public void testTable() throws Exception { Configuration configuration = new Configuration(); diff --git a/agent-module/plugins-it/httpclient-it/httpclient-5-it/src/test/java/com/navercorp/pinpoint/it/plugin/httpclient5/ClosableAsyncHttpClientIT.java b/agent-module/plugins-it/httpclient-it/httpclient-5-it/src/test/java/com/navercorp/pinpoint/it/plugin/httpclient5/ClosableAsyncHttpClientIT.java index d93deb94717b..6f53520863e6 100644 --- a/agent-module/plugins-it/httpclient-it/httpclient-5-it/src/test/java/com/navercorp/pinpoint/it/plugin/httpclient5/ClosableAsyncHttpClientIT.java +++ b/agent-module/plugins-it/httpclient-it/httpclient-5-it/src/test/java/com/navercorp/pinpoint/it/plugin/httpclient5/ClosableAsyncHttpClientIT.java @@ -24,8 +24,8 @@ import com.navercorp.pinpoint.test.plugin.PinpointAgent; import com.navercorp.pinpoint.test.plugin.PluginTest; import org.apache.hc.client5.http.async.methods.SimpleHttpRequest; -import org.apache.hc.client5.http.async.methods.SimpleHttpRequests; import org.apache.hc.client5.http.async.methods.SimpleHttpResponse; +import org.apache.hc.client5.http.async.methods.SimpleRequestBuilder; import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; import org.apache.hc.client5.http.impl.async.HttpAsyncClients; import org.apache.hc.core5.concurrent.FutureCallback; @@ -47,7 +47,7 @@ public void test() throws Exception { httpClient.start(); try { - SimpleHttpRequest request = SimpleHttpRequests.get(getAddress()); + SimpleHttpRequest request = SimpleRequestBuilder.get().setUri(getAddress()).build(); Future future = httpClient.execute(request, new FutureCallback() { @Override public void completed(SimpleHttpResponse simpleHttpResponse) { diff --git a/agent-module/plugins-it/kafka-it/kafka-2-it/src/test/java/test/pinpoint/plugin/kafka/TestConsumer.java b/agent-module/plugins-it/kafka-it/kafka-2-it/src/test/java/test/pinpoint/plugin/kafka/TestConsumer.java index fd7cf10bb7a8..142b9b7ec8ad 100644 --- a/agent-module/plugins-it/kafka-it/kafka-2-it/src/test/java/test/pinpoint/plugin/kafka/TestConsumer.java +++ b/agent-module/plugins-it/kafka-it/kafka-2-it/src/test/java/test/pinpoint/plugin/kafka/TestConsumer.java @@ -27,6 +27,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.time.Duration; import java.util.Collections; import java.util.Iterator; import java.util.Properties; @@ -91,14 +92,14 @@ private void shutdown() { @Override public void run() { consumer.subscribe(Collections.singleton(TOPIC)); - consumer.poll(0); + consumer.poll(Duration.ZERO); consumer.seekToBeginning(Collections.singleton(new TopicPartition(TOPIC, PARTITION))); TestConsumerRecordEntryPoint entryPoint = new TestConsumerRecordEntryPoint(); try { while (true) { - ConsumerRecords records = consumer.poll(1000L); - if(records != null && records.count() > 0) { + ConsumerRecords records = consumer.poll(Duration.ofMillis(1000)); + if (records != null && records.count() > 0) { Iterator> iterator = records.iterator(); if (!iterator.hasNext()) { continue; @@ -109,7 +110,7 @@ public void run() { entryPoint.consumeRecord(records); } else if (traceType.equals(TRACE_TYPE_RECORD)) { offsetStore.setOffset(firstRecord.offset()); - records.forEach(record -> entryPoint.consumeRecord(record)); + records.forEach(entryPoint::consumeRecord); } } } diff --git a/agent-module/plugins-it/kafka-it/kafka-3-it/src/test/java/test/pinpoint/plugin/kafka/TestConsumer.java b/agent-module/plugins-it/kafka-it/kafka-3-it/src/test/java/test/pinpoint/plugin/kafka/TestConsumer.java index 2123303a1cdf..142b9b7ec8ad 100644 --- a/agent-module/plugins-it/kafka-it/kafka-3-it/src/test/java/test/pinpoint/plugin/kafka/TestConsumer.java +++ b/agent-module/plugins-it/kafka-it/kafka-3-it/src/test/java/test/pinpoint/plugin/kafka/TestConsumer.java @@ -27,6 +27,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.time.Duration; import java.util.Collections; import java.util.Iterator; import java.util.Properties; @@ -89,16 +90,15 @@ private void shutdown() { } @Override - @SuppressWarnings("deprecation") public void run() { consumer.subscribe(Collections.singleton(TOPIC)); - consumer.poll(0); + consumer.poll(Duration.ZERO); consumer.seekToBeginning(Collections.singleton(new TopicPartition(TOPIC, PARTITION))); TestConsumerRecordEntryPoint entryPoint = new TestConsumerRecordEntryPoint(); try { while (true) { - ConsumerRecords records = consumer.poll(1000L); + ConsumerRecords records = consumer.poll(Duration.ofMillis(1000)); if (records != null && records.count() > 0) { Iterator> iterator = records.iterator(); if (!iterator.hasNext()) { diff --git a/agent-module/plugins-it/netty-it/src/test/java/com/navercorp/pinpoint/it/plugin/netty/NettyIT.java b/agent-module/plugins-it/netty-it/src/test/java/com/navercorp/pinpoint/it/plugin/netty/NettyIT.java index 28b61d2acb19..ce3480952c59 100644 --- a/agent-module/plugins-it/netty-it/src/test/java/com/navercorp/pinpoint/it/plugin/netty/NettyIT.java +++ b/agent-module/plugins-it/netty-it/src/test/java/com/navercorp/pinpoint/it/plugin/netty/NettyIT.java @@ -99,7 +99,7 @@ protected void channelRead0(ChannelHandlerContext ctx, FullHttpResponse msg) { // verifier.verifyTrace(event("NETTY_HTTP", "io.netty.handler.codec.http.HttpObjectEncoder.encode(io.netty.channel.ChannelHandlerContext, java.lang.Object, java.util.List)", annotation("http.url", "/"))); } finally { channel.close().sync(); - workerGroup.shutdown(); + workerGroup.shutdownGracefully().sync(); } } @@ -148,7 +148,7 @@ protected void channelRead0(ChannelHandlerContext ctx, Object msg) { // verifier.verifyTrace(event("NETTY_HTTP", "io.netty.handler.codec.http.HttpObjectEncoder.encode(io.netty.channel.ChannelHandlerContext, java.lang.Object, java.util.List)", annotation("http.url", "/"))); } finally { channel.close().sync(); - workerGroup.shutdown(); + workerGroup.shutdownGracefully().sync(); } } diff --git a/agent-module/plugins-it/oracledb-it/oracledb-19-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/oracle/Oracle_IT_Base.java b/agent-module/plugins-it/oracledb-it/oracledb-19-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/oracle/Oracle_IT_Base.java index 9eb1d6376d91..608cb9a73675 100644 --- a/agent-module/plugins-it/oracledb-it/oracledb-19-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/oracle/Oracle_IT_Base.java +++ b/agent-module/plugins-it/oracledb-it/oracledb-19-it/src/test/java/com/navercorp/pinpoint/it/plugin/jdbc/oracle/Oracle_IT_Base.java @@ -60,7 +60,7 @@ protected static DriverProperties createDriverProperties() { @BeforeEach public void registerDriver() throws Exception { - Driver driver = driverClass.getDriver().newInstance(); + Driver driver = driverClass.getDriver().getConstructor().newInstance(); DriverManager.registerDriver(driver); } diff --git a/agent-module/plugins-test-module/plugins-it-utils-jdbc/src/main/java/com/navercorp/pinpoint/it/plugin/utils/jdbc/DataBaseTestCase.java b/agent-module/plugins-test-module/plugins-it-utils-jdbc/src/main/java/com/navercorp/pinpoint/it/plugin/utils/jdbc/DataBaseTestCase.java index fa2df79e90ae..64061c741594 100644 --- a/agent-module/plugins-test-module/plugins-it-utils-jdbc/src/main/java/com/navercorp/pinpoint/it/plugin/utils/jdbc/DataBaseTestCase.java +++ b/agent-module/plugins-test-module/plugins-it-utils-jdbc/src/main/java/com/navercorp/pinpoint/it/plugin/utils/jdbc/DataBaseTestCase.java @@ -84,7 +84,7 @@ public void setup(String dbType, String executeQuery, DriverProperties driverPro try { JDBCDriverClass jdbcDriverClass = getJDBCDriverClass(); - Driver driver = jdbcDriverClass.getDriver().newInstance(); + Driver driver = jdbcDriverClass.getDriver().getConstructor().newInstance(); DriverManager.registerDriver(driver); } catch (Exception e) { throw new RuntimeException("driver register error", e); diff --git a/agent-module/plugins/httpclient3/src/main/java/com/navercorp/pinpoint/plugin/httpclient3/HttpClient3EntityExtractor.java b/agent-module/plugins/httpclient3/src/main/java/com/navercorp/pinpoint/plugin/httpclient3/HttpClient3EntityExtractor.java index 849e4ca437c5..41f8aee7f30d 100644 --- a/agent-module/plugins/httpclient3/src/main/java/com/navercorp/pinpoint/plugin/httpclient3/HttpClient3EntityExtractor.java +++ b/agent-module/plugins/httpclient3/src/main/java/com/navercorp/pinpoint/plugin/httpclient3/HttpClient3EntityExtractor.java @@ -21,13 +21,14 @@ import com.navercorp.pinpoint.bootstrap.plugin.request.util.EntityExtractor; import com.navercorp.pinpoint.bootstrap.util.FixedByteArrayOutputStream; import com.navercorp.pinpoint.common.util.StringUtils; -import org.apache.commons.httpclient.HttpConstants; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.methods.ByteArrayRequestEntity; import org.apache.commons.httpclient.methods.EntityEnclosingMethod; import org.apache.commons.httpclient.methods.RequestEntity; import org.apache.commons.httpclient.methods.StringRequestEntity; +import java.nio.charset.StandardCharsets; + /** * @author Woonduk Kang(emeroad) */ @@ -49,7 +50,7 @@ public String getEntity(HttpMethod httpMethod) { try { String entityValue; String charSet = entityEnclosingMethod.getRequestCharSet(); - charSet = StringUtils.defaultIfEmpty(charSet, HttpConstants.DEFAULT_CONTENT_CHARSET); + charSet = StringUtils.defaultIfEmpty(charSet, StandardCharsets.ISO_8859_1.name()); if (entity instanceof ByteArrayRequestEntity || entity instanceof StringRequestEntity) { entityValue = entityUtilsToString(entity, charSet); @@ -72,12 +73,10 @@ private static String entityUtilsToString(final RequestEntity entity, final Stri entity.writeRequest(outStream); final String entityValue = outStream.toString(charSet); if (entity.getContentLength() > MAX_READ_SIZE) { - StringBuilder sb = new StringBuilder(); - sb.append(entityValue); - sb.append(" (HTTP entity is large. length: "); - sb.append(entity.getContentLength()); - sb.append(" )"); - return sb.toString(); + return entityValue + + " (HTTP entity is large. length: " + + entity.getContentLength() + + " )"; } return entityValue; diff --git a/agent-module/plugins/ktor/src/main/java/com/navercorp/pinpoint/plugin/ktor/interceptor/HttpRequestAdaptor.java b/agent-module/plugins/ktor/src/main/java/com/navercorp/pinpoint/plugin/ktor/interceptor/HttpRequestAdaptor.java index c029c672f4e8..1847394e26ba 100644 --- a/agent-module/plugins/ktor/src/main/java/com/navercorp/pinpoint/plugin/ktor/interceptor/HttpRequestAdaptor.java +++ b/agent-module/plugins/ktor/src/main/java/com/navercorp/pinpoint/plugin/ktor/interceptor/HttpRequestAdaptor.java @@ -21,6 +21,7 @@ import com.navercorp.pinpoint.common.util.CollectionUtils; import io.netty.channel.Channel; import io.netty.handler.codec.http.HttpHeaders; +import io.netty.handler.codec.http.HttpMethod; import java.net.InetAddress; import java.net.InetSocketAddress; @@ -59,11 +60,7 @@ public Collection getHeaderNames(HttpRequestAndContext httpRequestAndCon if (CollectionUtils.isEmpty(headerNames)) { return Collections.emptyList(); } - Set values = new HashSet<>(headerNames.size()); - for (String headerName : headerNames) { - values.add(headerName); - } - return values; + return new HashSet<>(headerNames); } catch (Exception ignored) { } return Collections.emptyList(); @@ -72,7 +69,9 @@ public Collection getHeaderNames(HttpRequestAndContext httpRequestAndCon @Override public String getRpcName(HttpRequestAndContext httpRequestAndContext) { try { - return UriUtils.path(httpRequestAndContext.getHttpRequest().uri()); + @SuppressWarnings("deprecation") + String uri = httpRequestAndContext.getHttpRequest().getUri(); + return UriUtils.path(uri); } catch (Exception ignored) { } return null; @@ -81,7 +80,9 @@ public String getRpcName(HttpRequestAndContext httpRequestAndContext) { @Override public String getMethodName(HttpRequestAndContext httpRequestAndContext) { try { - return httpRequestAndContext.getHttpRequest().method().name(); + @SuppressWarnings("deprecation") + HttpMethod method = httpRequestAndContext.getHttpRequest().getMethod(); + return method.name(); } catch (Exception ignored) { } return null; diff --git a/agent-module/plugins/ktor/src/main/java/com/navercorp/pinpoint/plugin/ktor/interceptor/MethodFilterExtractor.java b/agent-module/plugins/ktor/src/main/java/com/navercorp/pinpoint/plugin/ktor/interceptor/MethodFilterExtractor.java index 990d9d3a672a..f8fc12b8bc94 100644 --- a/agent-module/plugins/ktor/src/main/java/com/navercorp/pinpoint/plugin/ktor/interceptor/MethodFilterExtractor.java +++ b/agent-module/plugins/ktor/src/main/java/com/navercorp/pinpoint/plugin/ktor/interceptor/MethodFilterExtractor.java @@ -18,6 +18,7 @@ import com.navercorp.pinpoint.bootstrap.config.Filter; import com.navercorp.pinpoint.bootstrap.plugin.request.util.ParameterExtractor; +import io.netty.handler.codec.http.HttpMethod; public class MethodFilterExtractor implements ParameterExtractor { @@ -32,7 +33,9 @@ public MethodFilterExtractor(Filter excludeProfileMethodFilter, Paramete @Override public String extractParameter(HttpRequestAndContext httpRequestAndContext) { - if (excludeProfileMethodFilter.filter(httpRequestAndContext.getHttpRequest().method().name())) { + @SuppressWarnings("deprecation") + HttpMethod method = httpRequestAndContext.getHttpRequest().getMethod(); + if (excludeProfileMethodFilter.filter(method.name())) { return null; } return delegate.extractParameter(httpRequestAndContext); diff --git a/agent-module/plugins/netty/src/main/java/com/navercorp/pinpoint/plugin/netty/NettyClientRequestWrapper.java b/agent-module/plugins/netty/src/main/java/com/navercorp/pinpoint/plugin/netty/NettyClientRequestWrapper.java index 050bd9f2627f..5d48b61d56a3 100644 --- a/agent-module/plugins/netty/src/main/java/com/navercorp/pinpoint/plugin/netty/NettyClientRequestWrapper.java +++ b/agent-module/plugins/netty/src/main/java/com/navercorp/pinpoint/plugin/netty/NettyClientRequestWrapper.java @@ -49,6 +49,7 @@ public String getDestinationId() { } @Override + @SuppressWarnings("deprecation") public String getUrl() { if (this.httpMessage instanceof HttpRequest) { return ((HttpRequest) httpMessage).getUri(); diff --git a/agent-module/plugins/vertx/src/main/java/com/navercorp/pinpoint/plugin/vertx/VertxHttpClientRequestWrapper.java b/agent-module/plugins/vertx/src/main/java/com/navercorp/pinpoint/plugin/vertx/VertxHttpClientRequestWrapper.java index bcb409feadb3..a8c728e15105 100644 --- a/agent-module/plugins/vertx/src/main/java/com/navercorp/pinpoint/plugin/vertx/VertxHttpClientRequestWrapper.java +++ b/agent-module/plugins/vertx/src/main/java/com/navercorp/pinpoint/plugin/vertx/VertxHttpClientRequestWrapper.java @@ -44,7 +44,12 @@ public String getDestinationId() { @Override public String getUrl() { - return getHttpUrl(this.host, this.httpRequest.uri()); + return getHttpUrl(this.host, getUri()); + } + + @SuppressWarnings("deprecation") + private String getUri() { + return this.httpRequest.getUri(); } private static String getHttpUrl(final String host, final String uri) {