Skip to content

Commit

Permalink
Align span subtype for SqlServer (#2112)
Browse files Browse the repository at this point in the history
* use 'mssql' instead of 'sqlserver'

* fix integration tests

* fix typo

* update changelog

skip ci
  • Loading branch information
SylvainJuge authored Sep 13, 2021
1 parent 2533c5e commit 8f771d9
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ endif::[]
[[release-notes-1.26.0]]
==== 1.26.0 - YYYY/MM/DD
===== Potentially breaking changes
* If you rely on Database span subtype and use Microsoft SQL Server, the span subtype has been changed from `sqlserver`
to `mssql` to align with other agents.
[float]
===== Features
* Improved naming for Spring controllers - {pull}1906[#1906]
Expand Down Expand Up @@ -62,6 +66,7 @@ user to configure an arbitrary agent version that will be downloaded from maven
* Fix gRPC non-terminated (therefore non-reported) client spans - {pull}2067[#2067]
* Fix Webflux response status code - {pull}1948[#1948]
* Ensure path filtering is applied when Servlet path is not available - {pull}2099[#2099]
* Align span subtype for MS SqlServer - {pull}2112[#2112]
[float]
===== Refactorings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private void verifySpanType(Span span) {
}
} else {
if (!allowUnlistedSubtype && hasSubtypes) {
getMandatoryJson(subTypesJson, subType, String.format("span subtype '%s' is not allowed by the sped for type '%s'", subType, type));
getMandatoryJson(subTypesJson, subType, String.format("span subtype '%s' is not allowed by the spec for type '%s'", subType, type));
}
}

Expand Down
6 changes: 3 additions & 3 deletions apm-agent-core/src/test/resources/json-specs/span_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
"mssql": {
"__description": "Microsoft SQL Server",
"__used_by": [
"nodejs"
"nodejs",
"java"
]
},
"mysql": {
Expand Down Expand Up @@ -183,9 +184,8 @@
]
},
"sqlserver": {
"__description": "Microsoft SQL Server",
"__description": "Microsoft SQL Server (deprecated, use mssql instead)",
"__used_by": [
"java"
]
},
"unknown": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static Iterable<Object[]> data() {
{"jdbc:tc:postgresql:9://hostname/databasename", "postgresql"},
{"jdbc:tc:postgresql:10://hostname/databasename", "postgresql"},
{"jdbc:tc:mariadb:10://hostname/databasename", "mariadb"},
{"jdbc:tc:sqlserver:2017-CU12://hostname/databasename", "sqlserver"},
{"jdbc:tc:sqlserver:2017-CU12://hostname/databasename", "mssql"},
{"jdbc:tc:db2:11.5.0.0a://hostname/databasename", "db2"},
{"jdbc:tc:oracle://hostname/databasename", "oracle"},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8f771d9

Please sign in to comment.