From bcc957d97d73af3c0935c63359cfc265909f3b6f Mon Sep 17 00:00:00 2001 From: Sylvain Juge Date: Wed, 8 Sep 2021 14:26:54 +0200 Subject: [PATCH] use 'mssql' instead of 'sqlserver' --- .../agent/jdbc/helper/ConnectionMetaData.java | 2 +- .../jdbc/helper/ConnectionMetaDataTest.java | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaData.java b/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaData.java index fd26d5ae804..c20f8225266 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaData.java +++ b/apm-agent-plugins/apm-jdbc-plugin/src/main/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaData.java @@ -430,7 +430,7 @@ ConnectionMetaData parse(String connectionUrl, String instance, String user) { if (indexOfInstance > 0) { host = host.substring(0, indexOfInstance); } - return new ConnectionMetaData(dbVendor, host, port, instance, user); + return new ConnectionMetaData("mssql", host, port, instance, user); } }, diff --git a/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaDataTest.java b/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaDataTest.java index 5f4fd9d6408..af3e4a0f860 100644 --- a/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaDataTest.java +++ b/apm-agent-plugins/apm-jdbc-plugin/src/test/java/co/elastic/apm/agent/jdbc/helper/ConnectionMetaDataTest.java @@ -234,23 +234,23 @@ void testMariadb() { @Test void testSqlserver() { // https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15 - testUrl("jdbc:sqlserver://myhost\\instance:666", "sqlserver", "myhost", 666); - testUrl("jdbc:sqlserver://myhost\\instance:666;prop1=val1;prop2=val2", "sqlserver", "myhost", 666); - testUrl("jdbc:sqlserver://myhost:666", "sqlserver", "myhost", 666); - testUrl("jdbc:sqlserver://myhost:666;prop1=val1;prop2=val2", "sqlserver", "myhost", 666); - testUrl("jdbc:sqlserver://myhost\\instance", "sqlserver", "myhost", 1433); - testUrl("jdbc:sqlserver://myhost\\instance;prop1=val1;prop2=val2", "sqlserver", "myhost", 1433); - testUrl("jdbc:sqlserver://myhost", "sqlserver", "myhost", 1433); - testUrl("jdbc:sqlserver://myhost;prop1=val1;prop2=val2", "sqlserver", "myhost", 1433); - testUrl("jdbc:sqlserver://", "sqlserver", "localhost", 1433); - testUrl("jdbc:sqlserver://;prop1=val1;prop2=val2", "sqlserver", "localhost", 1433); - testUrl("jdbc:sqlserver://;", "sqlserver", "localhost", 1433); - testUrl("jdbc:sqlserver://;serverName=myhost", "sqlserver", "myhost", 1433); - testUrl("jdbc:sqlserver://;prop1=val1;serverName=myhost", "sqlserver", "myhost", 1433); - testUrl("jdbc:sqlserver://;serverName=myhost;prop1=val1", "sqlserver", "myhost", 1433); - testUrl("jdbc:sqlserver://;serverName=myhost\\instance;prop1=val1", "sqlserver", "myhost", 1433); + testUrl("jdbc:sqlserver://myhost\\instance:666", "mssql", "myhost", 666); + testUrl("jdbc:sqlserver://myhost\\instance:666;prop1=val1;prop2=val2", "mssql", "myhost", 666); + testUrl("jdbc:sqlserver://myhost:666", "mssql", "myhost", 666); + testUrl("jdbc:sqlserver://myhost:666;prop1=val1;prop2=val2", "mssql", "myhost", 666); + testUrl("jdbc:sqlserver://myhost\\instance", "mssql", "myhost", 1433); + testUrl("jdbc:sqlserver://myhost\\instance;prop1=val1;prop2=val2", "mssql", "myhost", 1433); + testUrl("jdbc:sqlserver://myhost", "mssql", "myhost", 1433); + testUrl("jdbc:sqlserver://myhost;prop1=val1;prop2=val2", "mssql", "myhost", 1433); + testUrl("jdbc:sqlserver://", "mssql", "localhost", 1433); + testUrl("jdbc:sqlserver://;prop1=val1;prop2=val2", "mssql", "localhost", 1433); + testUrl("jdbc:sqlserver://;", "mssql", "localhost", 1433); + testUrl("jdbc:sqlserver://;serverName=myhost", "mssql", "myhost", 1433); + testUrl("jdbc:sqlserver://;prop1=val1;serverName=myhost", "mssql", "myhost", 1433); + testUrl("jdbc:sqlserver://;serverName=myhost;prop1=val1", "mssql", "myhost", 1433); + testUrl("jdbc:sqlserver://;serverName=myhost\\instance;prop1=val1", "mssql", "myhost", 1433); testUrl("jdbc:sqlserver://;serverName=3ffe:8311:eeee:f70f:0:5eae:10.203.31.9\\instance;prop1=val1", - "sqlserver", "3ffe:8311:eeee:f70f:0:5eae:10.203.31.9", 1433); + "mssql", "3ffe:8311:eeee:f70f:0:5eae:10.203.31.9", 1433); } @Test