You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- autoConfigEmulator (boolean): Automatically configure the connection to try to connect to the Cloud Spanner emulator. You do not need to specify any host or port in the connection string as long as the emulator is running on the default host/port (localhost:9010). The instance and database in the connection string will automatically be created if these do not yet exist on the emulator. This means that you do not need to execute any `gcloud` commands on the emulator to create the instance and database before you can connect to it. Example: `jdbc:cloudspanner:/projects/test-project/instances/test-instance/databases/test-db;autoConfigEmulator=true`
38
38
- usePlainText (boolean): Sets whether the JDBC connection should establish an unencrypted connection to a (local) server. This option can only be used when connecting to a local emulator that does not require an encrypted connection, and that does not require authentication. Example: `jdbc:cloudspanner://localhost:9010/projects/test-project/instances/test-instance/databases/test-db;usePlainText=true`
39
39
- optimizerVersion (String): Sets the default query optimizer version to use for this connection. See also https://cloud.google.com/spanner/docs/query-optimizer/query-optimizer-versions.
40
+
- enableExtendedTracing (boolean): Enables extended OpenTelemetry tracing of queries that are executed by a JDBC connection. When enabled, the SQL string of the query that is executed is added as a property to the trace.
41
+
- enableApiTracing (boolean): Enables API OpenTelemetry tracing of all RPCs that are executed by the JDBC driver. When enabled, a trace will be created for each RPC invocation that is executed by the JDBC driver. Enable this to investigate latency problems and/or RPCs that are being retried.
40
42
41
43
#### Advanced Properties
42
44
- minSessions (int): Sets the minimum number of sessions in the backing session pool. Defaults to 100.
@@ -46,6 +48,88 @@ custom_content: |
46
48
- oauthToken (string): A valid pre-existing OAuth token to use for authentication for this connection. Setting this property will take precedence over any value set for a credentials file.
47
49
- lenient (boolean): Enable this to force the JDBC driver to ignore unknown properties in the connection URL. Some applications automatically add additional properties to the URL that are not recognized by the JDBC driver. Normally, the JDBC driver will reject this, unless `lenient` mode is enabled.
48
50
51
+
### OpenTelemetry Tracing
52
+
The Spanner JDBC driver supports OpenTelemetry tracing. You can configure the OpenTelemetry instance
53
+
that should be used in two ways:
54
+
1. Register a global OpenTelemetry instance. This instance will automatically be picked up by the Spanner JDBC driver.
55
+
2. Add an OpenTelemetry instance with the key `openTelemetry` to the `java.util.Properties` instance that is used to create the JDBC connection.
56
+
57
+
By default, the traces that are generated by the Spanner JDBC driver do not include the SQL
58
+
statement. You can include the SQL statement with the traces by adding the property `enableExtendedTracing=true`
59
+
to the JDBC connection URL.
60
+
61
+
#### Example Using Global OpenTelemetry
62
+
Create and register a global OpenTelemetry object before creating a JDBC connection.
63
+
See also the [Spring Data JDBC Sample](samples/spring-data-jdbc) for an example for how to
64
+
configure OpenTelemetry in combination with Spring Data.
65
+
66
+
See [Latency Debugging Guide](documentation/latency-debugging-guide.md) for more information on how to use these traces.
0 commit comments