Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align span subtype for SqlServer #2112

Merged
merged 4 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -226,7 +226,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