@@ -49,20 +49,39 @@ public final class DbIncubatingAttributes {
49
49
longKey ("db.cassandra.speculative_execution_count" );
50
50
51
51
/**
52
- * The name of the primary Cassandra table that the operation is acting upon, including the
53
- * keyspace name (if applicable).
52
+ * Deprecated, use {@code db.collection.name} instead.
53
+ *
54
+ * @deprecated Deprecated, use `db.collection.name` instead.
55
+ */
56
+ @ Deprecated
57
+ public static final AttributeKey <String > DB_CASSANDRA_TABLE = stringKey ("db.cassandra.table" );
58
+
59
+ /**
60
+ * The name of the connection pool; unique within the instrumented application. In case the
61
+ * connection pool implementation doesn't provide a name, instrumentation should use a combination
62
+ * of {@code server.address} and {@code server.port} attributes formatted as {@code
63
+ * server.address:server.port}.
64
+ */
65
+ public static final AttributeKey <String > DB_CLIENT_CONNECTIONS_POOL_NAME =
66
+ stringKey ("db.client.connections.pool.name" );
67
+
68
+ /** The state of a connection in the pool */
69
+ public static final AttributeKey <String > DB_CLIENT_CONNECTIONS_STATE =
70
+ stringKey ("db.client.connections.state" );
71
+
72
+ /**
73
+ * The name of a collection (table, container) within the database.
54
74
*
55
75
* <p>Notes:
56
76
*
57
77
* <ul>
58
- * <li>This mirrors the db.sql.table attribute but references cassandra rather than sql. It is
59
- * not recommended to attempt any client-side parsing of {@code db.statement} just to get
60
- * this property, but it should be set if it is provided by the library being instrumented.
61
- * If the operation is acting upon an anonymous table, or more than one table, this value
62
- * MUST NOT be set.
78
+ * <li>If the collection name is parsed from the query, it SHOULD match the value provided in
79
+ * the query and may be qualified with the schema and database name. It is RECOMMENDED to
80
+ * capture the value as provided by the application without attempting to do any case
81
+ * normalization.
63
82
* </ul>
64
83
*/
65
- public static final AttributeKey <String > DB_CASSANDRA_TABLE = stringKey ("db.cassandra.table " );
84
+ public static final AttributeKey <String > DB_COLLECTION_NAME = stringKey ("db.collection.name " );
66
85
67
86
/**
68
87
* Deprecated, use {@code server.address}, {@code server.port} attributes instead.
@@ -80,7 +99,12 @@ public final class DbIncubatingAttributes {
80
99
public static final AttributeKey <String > DB_COSMOSDB_CONNECTION_MODE =
81
100
stringKey ("db.cosmosdb.connection_mode" );
82
101
83
- /** Cosmos DB container name. */
102
+ /**
103
+ * Deprecated, use {@code db.collection.name} instead.
104
+ *
105
+ * @deprecated Deprecated, use `db.collection.name` instead.
106
+ */
107
+ @ Deprecated
84
108
public static final AttributeKey <String > DB_COSMOSDB_CONTAINER =
85
109
stringKey ("db.cosmosdb.container" );
86
110
@@ -109,11 +133,8 @@ public final class DbIncubatingAttributes {
109
133
stringKey ("db.elasticsearch.cluster.name" );
110
134
111
135
/**
112
- * Deprecated, use {@code db.instance.id} instead.
113
- *
114
- * @deprecated Deprecated, use `db.instance.id` instead.
136
+ * Represents the human-readable identifier of the node/instance to which a request was routed.
115
137
*/
116
- @ Deprecated
117
138
public static final AttributeKey <String > DB_ELASTICSEARCH_NODE_NAME =
118
139
stringKey ("db.elasticsearch.node.name" );
119
140
@@ -134,13 +155,13 @@ public final class DbIncubatingAttributes {
134
155
stringKeyTemplate ("db.elasticsearch.path_parts" );
135
156
136
157
/**
137
- * An identifier (address, unique name, or any other identifier) of the database instance that is
138
- * executing queries or mutations on the current connection. This is useful in cases where the
139
- * database is running in a clustered environment and the instrumentation is able to record the
140
- * node executing the query. The client may obtain this value in databases like MySQL using
141
- * queries like {@code select @@hostname} .
158
+ * Deprecated, no general replacement at this time. For Elasticsearch, use {@code
159
+ * db.elasticsearch.node.name} instead.
160
+ *
161
+ * @deprecated Deprecated, no general replacement at this time. For Elasticsearch, use
162
+ * `db.elasticsearch.node.name` instead .
142
163
*/
143
- public static final AttributeKey <String > DB_INSTANCE_ID = stringKey ("db.instance.id" );
164
+ @ Deprecated public static final AttributeKey <String > DB_INSTANCE_ID = stringKey ("db.instance.id" );
144
165
145
166
/**
146
167
* Removed, no replacement at this time.
@@ -151,90 +172,129 @@ public final class DbIncubatingAttributes {
151
172
public static final AttributeKey <String > DB_JDBC_DRIVER_CLASSNAME =
152
173
stringKey ("db.jdbc.driver_classname" );
153
174
154
- /** The MongoDB collection being accessed within the database stated in {@code db.name}. */
175
+ /**
176
+ * Deprecated, use {@code db.collection.name} instead.
177
+ *
178
+ * @deprecated Deprecated, use `db.collection.name` instead.
179
+ */
180
+ @ Deprecated
155
181
public static final AttributeKey <String > DB_MONGODB_COLLECTION =
156
182
stringKey ("db.mongodb.collection" );
157
183
158
184
/**
159
- * The Microsoft SQL Server <a
160
- * href="https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15">instance
161
- * name</a> connecting to. This name is used to determine the port of a named instance.
185
+ * Deprecated, SQL Server instance is now populated as a part of {@code db.namespace} attribute.
186
+ *
187
+ * @deprecated Deprecated, SQL Server instance is now populated as a part of `db.namespace`
188
+ * attribute.
189
+ */
190
+ @ Deprecated
191
+ public static final AttributeKey <String > DB_MSSQL_INSTANCE_NAME =
192
+ stringKey ("db.mssql.instance_name" );
193
+
194
+ /**
195
+ * Deprecated, use {@code db.namespace} instead.
196
+ *
197
+ * @deprecated Deprecated, use `db.namespace` instead.
198
+ */
199
+ @ Deprecated public static final AttributeKey <String > DB_NAME = stringKey ("db.name" );
200
+
201
+ /**
202
+ * The name of the database, fully qualified within the server address and port.
162
203
*
163
204
* <p>Notes:
164
205
*
165
206
* <ul>
166
- * <li>If setting a {@code db.mssql.instance_name}, {@code server.port} is no longer required
167
- * (but still recommended if non-standard).
207
+ * <li>If a database system has multiple namespace components, they SHOULD be concatenated
208
+ * (potentially using database system specific conventions) from most general to most
209
+ * specific namespace component, and more specific namespaces SHOULD NOT be captured without
210
+ * the more general namespaces, to ensure that "startswith" queries for the more
211
+ * general namespaces will be valid. Semantic conventions for individual database systems
212
+ * SHOULD document what {@code db.namespace} means in the context of that system. It is
213
+ * RECOMMENDED to capture the value as provided by the application without attempting to do
214
+ * any case normalization.
168
215
* </ul>
169
216
*/
170
- public static final AttributeKey <String > DB_MSSQL_INSTANCE_NAME =
171
- stringKey ("db.mssql.instance_name" );
217
+ public static final AttributeKey <String > DB_NAMESPACE = stringKey ("db.namespace" );
172
218
173
219
/**
174
- * This attribute is used to report the name of the database being accessed. For commands that
175
- * switch the database, this should be set to the target database (even if the command fails).
220
+ * Deprecated, use {@code db.operation.name} instead.
221
+ *
222
+ * @deprecated Deprecated, use `db.operation.name` instead.
223
+ */
224
+ @ Deprecated public static final AttributeKey <String > DB_OPERATION = stringKey ("db.operation" );
225
+
226
+ /**
227
+ * The name of the operation or command being executed.
176
228
*
177
229
* <p>Notes:
178
230
*
179
231
* <ul>
180
- * <li>In some SQL databases, the database name to be used is called "schema name". In
181
- * case there are multiple layers that could be considered for database name (e.g. Oracle
182
- * instance name and schema name), the database name to be used is the more specific layer
183
- * (e.g. Oracle schema name).
232
+ * <li>It is RECOMMENDED to capture the value as provided by the application without attempting
233
+ * to do any case normalization.
184
234
* </ul>
185
235
*/
186
- public static final AttributeKey <String > DB_NAME = stringKey ("db.name" );
236
+ public static final AttributeKey <String > DB_OPERATION_NAME = stringKey ("db.operation .name" );
187
237
188
238
/**
189
- * The name of the operation being executed, e.g. the <a
190
- * href="https://docs.mongodb.com/manual/reference/command/#database-operations">MongoDB command
191
- * name</a> such as {@code findAndModify}, or the SQL keyword.
239
+ * The query parameters used in {@code db.query.text}, with {@code <key>} being the parameter
240
+ * name, and the attribute value being the parameter value.
192
241
*
193
242
* <p>Notes:
194
243
*
195
244
* <ul>
196
- * <li>When setting this to an SQL keyword, it is not recommended to attempt any client-side
197
- * parsing of {@code db.statement} just to get this property, but it should be set if the
198
- * operation name is provided by the library being instrumented. If the SQL statement has an
199
- * ambiguous operation, or performs more than one operation, this value may be omitted.
245
+ * <li>Query parameters should only be captured when {@code db.query.text} is parameterized with
246
+ * placeholders. If a parameter has no name and instead is referenced only by index, then
247
+ * {@code <key>} SHOULD be the 0-based index.
200
248
* </ul>
201
249
*/
202
- public static final AttributeKey <String > DB_OPERATION = stringKey ("db.operation" );
250
+ public static final AttributeKeyTemplate <String > DB_QUERY_PARAMETER =
251
+ stringKeyTemplate ("db.query.parameter" );
252
+
253
+ /** The database query being executed. */
254
+ public static final AttributeKey <String > DB_QUERY_TEXT = stringKey ("db.query.text" );
203
255
204
256
/**
205
- * The index of the database being accessed as used in the <a
206
- * href="https://redis.io/commands/select">{@code SELECT} command</a>, provided as an integer. To
207
- * be used instead of the generic {@code db.name} attribute .
257
+ * Deprecated, use {@code db.namespace} instead.
258
+ *
259
+ * @deprecated Deprecated, use ` db.namespace` instead .
208
260
*/
261
+ @ Deprecated
209
262
public static final AttributeKey <Long > DB_REDIS_DATABASE_INDEX =
210
263
longKey ("db.redis.database_index" );
211
264
212
265
/**
213
- * The name of the primary table that the operation is acting upon, including the database name
214
- * (if applicable).
266
+ * Deprecated, use {@code db.collection.name} instead.
267
+ *
268
+ * @deprecated Deprecated, use `db.collection.name` instead.
269
+ */
270
+ @ Deprecated public static final AttributeKey <String > DB_SQL_TABLE = stringKey ("db.sql.table" );
271
+
272
+ /**
273
+ * The database statement being executed.
274
+ *
275
+ * @deprecated The database statement being executed.
276
+ */
277
+ @ Deprecated public static final AttributeKey <String > DB_STATEMENT = stringKey ("db.statement" );
278
+
279
+ /**
280
+ * The database management system (DBMS) product as identified by the client instrumentation.
215
281
*
216
282
* <p>Notes:
217
283
*
218
284
* <ul>
219
- * <li>It is not recommended to attempt any client-side parsing of {@code db.statement} just to
220
- * get this property, but it should be set if it is provided by the library being
221
- * instrumented. If the operation is acting upon an anonymous table, or more than one table,
222
- * this value MUST NOT be set.
285
+ * <li>The actual DBMS may differ from the one identified by the client. For example, when using
286
+ * PostgreSQL client libraries to connect to a CockroachDB, the {@code db.system} is set to
287
+ * {@code postgresql} based on the instrumentation's best knowledge.
223
288
* </ul>
224
289
*/
225
- public static final AttributeKey <String > DB_SQL_TABLE = stringKey ("db.sql.table" );
226
-
227
- /** The database statement being executed. */
228
- public static final AttributeKey <String > DB_STATEMENT = stringKey ("db.statement" );
290
+ public static final AttributeKey <String > DB_SYSTEM = stringKey ("db.system" );
229
291
230
292
/**
231
- * An identifier for the database management system (DBMS) product being used. See below for a
232
- * list of well-known identifiers.
293
+ * Deprecated, no replacement at this time.
294
+ *
295
+ * @deprecated Deprecated, no replacement at this time.
233
296
*/
234
- public static final AttributeKey <String > DB_SYSTEM = stringKey ("db.system" );
235
-
236
- /** Username for accessing the database. */
237
- public static final AttributeKey <String > DB_USER = stringKey ("db.user" );
297
+ @ Deprecated public static final AttributeKey <String > DB_USER = stringKey ("db.user" );
238
298
239
299
// Enum definitions
240
300
/** Values for {@link #DB_CASSANDRA_CONSISTENCY_LEVEL}. */
@@ -275,6 +335,17 @@ public static final class DbCassandraConsistencyLevelValues {
275
335
private DbCassandraConsistencyLevelValues () {}
276
336
}
277
337
338
+ /** Values for {@link #DB_CLIENT_CONNECTIONS_STATE}. */
339
+ public static final class DbClientConnectionsStateValues {
340
+ /** idle. */
341
+ public static final String IDLE = "idle" ;
342
+
343
+ /** used. */
344
+ public static final String USED = "used" ;
345
+
346
+ private DbClientConnectionsStateValues () {}
347
+ }
348
+
278
349
/** Values for {@link #DB_COSMOSDB_CONNECTION_MODE}. */
279
350
public static final class DbCosmosdbConnectionModeValues {
280
351
/** Gateway (HTTP) connections mode. */
0 commit comments