Don't make spans for comments or SET statements in SQL
In playing with sleuth, which layers on brave now, I noticed we create spans for a whole lot of junk. This happens to the first trace on a JDBC connection. I think we should not add SET statements or SQL comments to the trace.
cc @marcingrzejszczak @shakuzen @schrepfler @devinsba @angrybobcat
[
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "e415bbea6a2e3b5d",
"kind": "SERVER",
"name": "get",
"timestamp": 1518487784242552,
"duration": 58115,
"localEndpoint": {
"serviceName": "backend",
"ipv4": "192.168.1.117"
},
"remoteEndpoint": {
"ipv4": "127.0.0.1",
"port": 51527
},
"tags": {
"http.path": "/api",
"mvc.controller.class": "Backend",
"mvc.controller.method": "printDate"
},
"shared": true
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "204018b9b80eb785",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784022729,
"duration": 32182,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "f12479b34e62a1f4",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784057645,
"duration": 389,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "760cf1ca5b00d106",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784058435,
"duration": 256,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "da2e4f78230009d0",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784060545,
"duration": 224,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "64f37d8c50f7c8c5",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784061217,
"duration": 195,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "ccab9dfc21b802a0",
"kind": "CLIENT",
"name": "select",
"timestamp": 1518487784061780,
"duration": 267,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SELECT @@session.tx_isolation"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "05dc86bf6bc3847a",
"kind": "CLIENT",
"name": "select",
"timestamp": 1518487784074581,
"duration": 586,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SELECT COUNT(*) from zipkin_spans"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "13b5196e4fdae416",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784175884,
"duration": 815,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "7e68a7732b26f6bd",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784177339,
"duration": 283,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "80dbf7f33fbc4d58",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784177803,
"duration": 225,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "82e9476bc383a9f1",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784178197,
"duration": 211,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "9c1a87c9a1ed3795",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784178574,
"duration": 269,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "dccaf494ae86604b",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784181826,
"duration": 692,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "d3db2299822d8bb2",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784183113,
"duration": 243,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "dc31096681cb0681",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784183574,
"duration": 221,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "6dab7d24b19286e6",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784184002,
"duration": 281,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "fc3f32651ed8efbf",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784184474,
"duration": 248,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "17c8b3f3016a65f6",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784187246,
"duration": 697,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "8225489562cdef80",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784188548,
"duration": 270,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "5a1d9b27cafe4c22",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784189036,
"duration": 258,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "fc662c9dae33e52a",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784189505,
"duration": 243,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "4d76b1ee126bb928",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784189917,
"duration": 588,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "0038390166bc5040",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784192610,
"duration": 575,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "dcd8007cccafb809",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784193772,
"duration": 297,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "a53a93fac7f6d4c6",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784194331,
"duration": 258,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "9cb026388c37d4d8",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784194807,
"duration": 253,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "9ed2f5878a703cf8",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784195226,
"duration": 222,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "b9e5bbb089fe1c59",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784198208,
"duration": 650,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "c10a4ea9c4656253",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784199421,
"duration": 257,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "ff0531f86c5d0c7e",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784199869,
"duration": 220,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "6c1798ef78673c22",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784200284,
"duration": 232,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "3a643452bbcf4e80",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784200680,
"duration": 213,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "ed818e3b83888f94",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784203608,
"duration": 766,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "6e801ec76cfa49ed",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784204894,
"duration": 254,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "b52b592bbb4a2713",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784205340,
"duration": 263,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "5c467c803e5f193f",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784205809,
"duration": 261,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "72b55a32a48323c4",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784206243,
"duration": 261,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "047d9cff7e768d43",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784209411,
"duration": 485,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "10f8cf830cffe5b6",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784210413,
"duration": 254,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "3dad97555e3ae576",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784211055,
"duration": 234,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "b5fc1e00bdbe8765",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784211476,
"duration": 258,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "a2d80c084de3a177",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784211901,
"duration": 238,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "d4ed01c43cc3110e",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784214466,
"duration": 511,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "74bb3091987f5b3e",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784215487,
"duration": 254,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "822cbf823e1ac1db",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784215941,
"duration": 234,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "e9f8d4feb2f9abf8",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784216366,
"duration": 247,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "a072c4fe6faddf2e",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784216783,
"duration": 253,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "e2e33bc7fa206534",
"kind": "CLIENT",
"name": "/*",
"timestamp": 1518487784219540,
"duration": 556,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "/* mysql-connector-java-5.1.45 ( Revision: 9131eefa398531c7dc98776e8a3fe839e544c5b2 ) */SELECT @@session.auto_increment_increment AS auto_increment_increment, @@character_set_client AS character_set_client, @@character_set_connection AS character_set_connection, @@character_set_results AS character_set_results, @@character_set_server AS character_set_server, @@collation_server AS collation_server, @@init_connect AS init_connect, @@interactive_timeout AS interactive_timeout, @@license AS license, @@lower_case_table_names AS lower_case_table_names, @@max_allowed_packet AS max_allowed_packet, @@net_buffer_length AS net_buffer_length, @@net_write_timeout AS net_write_timeout, @@query_cache_size AS query_cache_size, @@query_cache_type AS query_cache_type, @@sql_mode AS sql_mode, @@system_time_zone AS system_time_zone, @@time_zone AS time_zone, @@tx_isolation AS tx_isolation, @@wait_timeout AS wait_timeout"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "08a2100b1307d7af",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784220543,
"duration": 258,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET character_set_results = NULL"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "e20b143240249d0b",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784220974,
"duration": 230,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "0fb5d62b4a45b15f",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784221390,
"duration": 235,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "set session transaction read write"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "8345b5360f5631fe",
"kind": "CLIENT",
"name": "set",
"timestamp": 1518487784221769,
"duration": 234,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"sql.query": "SET autocommit=1"
}
},
{
"traceId": "d6abdbe228950d38",
"parentId": "d6abdbe228950d38",
"id": "e415bbea6a2e3b5d",
"kind": "CLIENT",
"name": "get",
"timestamp": 1518487784101492,
"duration": 197238,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"tags": {
"http.path": "/api"
}
},
{
"traceId": "d6abdbe228950d38",
"id": "d6abdbe228950d38",
"kind": "SERVER",
"name": "get",
"timestamp": 1518487783642865,
"duration": 691347,
"localEndpoint": {
"serviceName": "frontend",
"ipv4": "192.168.1.117"
},
"remoteEndpoint": {
"ipv6": "::1",
"port": 51523
},
"tags": {
"http.path": "/",
"mvc.controller.class": "Frontend",
"mvc.controller.method": "callBackend"
}
}
]
here's a photo of the beauty!
Firstly thanks for all the awesome work on Zipkin and this instrumentation @adriancole .
I ran into this issue today and have forked the mysql TracingStatementInterceptor locally and introduced a regex for excluding certain SQL statements. i.e.
private Pattern exclude = Pattern.compile("(set.+)|(commit)|(select @@session.tx_read_only)", Pattern.CASE_INSENSITIVE);
@Override
public ResultSetInternalMethods preProcess(String sql, Statement interceptedStatement,
Connection connection) {
// When running a prepared statement, sql will be null and we must fetch the sql from the statement itself
if (interceptedStatement instanceof PreparedStatement) {
sql = ((PreparedStatement) interceptedStatement).getPreparedSql();
}
if (exclude.matcher(sql).matches()) {
return null;
}
...
This works for us at the moment as we are generally using this locally to help identify perf issues etc but not sure this is a solution you would want to add for this issue? If so would be more than willing to submit a PR.
I guess some concerns would be the performance impact of adding a regex as part of this instrumentation and possibly making this regex configurable? Though not sure what the best approach for that would be?
I also ran into an interesting deadlock issue when 1st adding this instrumentation to an existing Spring Boot / Sleuth application with a c3po connection pool as outlined here in case anyone else has a similar issue.
Note that brave uses P6spy for jdbc integration, it has a few configuration options to exclude certain statements https://p6spy.readthedocs.io/en/latest/configandusage.html#excludecategories from being traced. The SET statement is not one of them AFAICT, commit/rollback is.
I was to make a similar comment to Jorg. we do want to consider what is required to do in impl vs composition. if this was the mysql driver.. with no means to configure except classpath or jdbc query params.. maybe we must define a pattern implementation at the brave abstraction.. or create a helper to do this.
some things similar are web skip patterns. these can be implemented as decorating filters. a config project sleuth makes some pattern autoconfigurations.
anyway this is the point to consider I think.. do we implement this or delegate to something else that can (ex decoration or another feature). I usually tend to the latter.
cc @anuraaga
On Tue, May 14, 2019, 12:16 AM Jorg Heymans [email protected] wrote:
Note that brave uses P6spy for jdbc integration, it has a few configuration options to exclude certain statements https://p6spy.readthedocs.io/en/latest/configandusage.html#excludecategories from being traced. The SET statement is not one of them AFAICT, commit/rollback is.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-zipkin-brave/issues/609?email_source=notifications&email_token=AAAPVVYZFBC5JXUDIRGPFZ3PVGH5DA5CNFSM4EQMPECKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVI2EOA#issuecomment-491889208, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAPVV3HLKHC5ZAPQHYZYWDPVGH5DANCNFSM4EQMPECA .
A few observations
-
/*should never be the name of a span. I suspect the MySQL instrumentation needs to be updated to handle this more sanely. FWIW, I don't think I've ever seen this I wonder if there is a connector option pretending that comment -
Traces of background spans like
SETand health check have always been annoying. I'm only interested in tracing queries in the context of a request (if you know what I mean ;) so HikariCP's background queries are boring. -
Unfortunately it's not as simple as filtering the span name by itself. Select used in health check I don't need but select used by the app I do.
It's not clear to me whether decoration etc have the flexibility for this sort of filtering. Though I don't know if an interceptor option does either - it's really a pain that MySQL connector doesn't use the perfectly good service loader mechanism for extension... I think we'd need to play around to see what ends up cleanest.
But definitely want to help getting rid of junk MySQL spans from my apps!
@anuraaga @patrickbray it just dawned on me that we should be able to get a sane default by looking at if this is a root span. If so, dump the set, etc.
ok here's a little example https://github.com/openzipkin/brave/pull/970
note you can definitely weed this stuff out with a FinishedSpanHandler meanwhile. Just look at the incoming context and see if it is root (parentIdAsLong == 0). just drop spans named "set" or "/* " by returning false.