|
16 | 16 | * Copyright (c) 2025, Oracle and/or its affiliates. |
17 | 17 | * */ |
18 | 18 |
|
19 | | -/** |
20 | | - * The database management system (DBMS) product as identified |
21 | | - * by the client instrumentation. |
22 | | - * |
| 19 | +/* |
| 20 | + * This file contains a copy of unstable semantic convention definitions |
| 21 | + * used by this package. |
| 22 | + * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv |
23 | 23 | */ |
24 | | -export const ATTR_DB_SYSTEM = 'db.system.name'; |
25 | 24 |
|
26 | 25 | /** |
27 | | - * The database associated with the connection, qualified by the instance name, database name and service name. |
| 26 | + * A database operation parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value. |
28 | 27 | * |
29 | | - * @example ORCL1|PDB1|db_high.adb.oraclecloud.com |
30 | | - * @example ORCL1|DB1|db_low.adb.oraclecloud.com |
31 | | - * |
32 | | - * @note It **SHOULD** be set to the combination of instance name, database name and |
33 | | - * service name following the `{instance_name}|{database_name}|{service_name}` pattern. |
34 | | - * For CDB architecture, database name would be pdb name. For Non-CDB, it would be |
35 | | - * **DB_NAME** parameter. |
36 | | - * This attribute has stability level RELEASE CANDIDATE. |
37 | | - * |
38 | | - * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
39 | | - */ |
40 | | -export const ATTR_DB_NAMESPACE = 'db.namespace'; |
41 | | - |
42 | | -/** |
43 | | - * The name of the operation or command being executed. |
| 28 | + * @example someval |
| 29 | + * @example 55 |
44 | 30 | * |
45 | | - * @example INSERT |
46 | | - * @example COMMIT |
47 | | - * @example SELECT |
| 31 | + * @note For example, a client-side maximum number of rows to read from the database |
| 32 | + * **MAY** be recorded as the `db.operation.parameter.max_rows` attribute. |
48 | 33 | * |
49 | | - * @note It is **RECOMMENDED** to capture the value as provided by the application without attempting to do any case normalization. |
50 | | - * If the operation name is parsed from the query text, it **SHOULD** be the first operation name found in the query. |
51 | | - * For batch operations, if the individual operations are known to have the same operation name then that operation name **SHOULD** be used prepended by `BATCH `, otherwise `db.operation.name` **SHOULD** be `BATCH` or some other database system specific term if more applicable. |
52 | | - * This attribute has stability level RELEASE CANDIDATE. |
| 34 | + * `db.query.text` parameters **SHOULD** be captured using `db.query.parameter.<key>` |
| 35 | + * instead of `db.operation.parameter.<key>`. |
53 | 36 | * |
54 | 37 | * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
55 | 38 | */ |
56 | | -export const ATTR_DB_OPERATION_NAME = 'db.operation.name'; |
| 39 | +export const ATTR_DB_OPERATION_PARAMETER = (key: string) => |
| 40 | + `db.operation.parameter.${key}`; |
57 | 41 |
|
58 | 42 | /** |
59 | | - * The database query being executed. |
60 | | - * |
61 | | - * @example SELECT * FROM wuser_table where username = :1 // bind by position |
62 | | - * @example SELECT * FROM wuser_table where username = :name // bind by name |
63 | | - * @example SELECT * FROM wuser_table where username = 'John' // literals |
| 43 | + * Deprecated, no replacement at this time. |
64 | 44 | * |
65 | | - * @note For sanitization see [Sanitization of `db.query.text`](../database/database-spans.md#sanitization-of-dbquerytext). |
66 | | - * For batch operations, if the individual operations are known to have the same query text then |
67 | | - * that query text **SHOULD** be used, otherwise all of the individual query texts **SHOULD** |
68 | | - * be concatenated with separator `; ` or some other database system specific separator if more applicable. |
69 | | - * |
70 | | - * Non-parameterized or Parameterized query text **SHOULD NOT** be collected by default unless |
71 | | - * explicitly configured and sanitized to exclude sensitive data, e.g. by redacting all |
72 | | - * literal values present in the query text. See Sanitization of `db.query.text`. |
73 | | - * |
74 | | - * Parameterized query text MUST also NOT be collected by default unless explicitly configured. |
75 | | - * The query parameter values themselves are opt-in, see [`db.operation.parameter.<key>`](../attributes-registry/db.md)) |
| 45 | + * @example readonly_user |
| 46 | + * @example reporting_user |
76 | 47 | * |
77 | 48 | * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
78 | | - */ |
79 | | -export const ATTR_DB_STATEMENT = 'db.query.text'; |
80 | | - |
81 | | -/** |
82 | | - * A database operation parameter, with <key> being the parameter name, |
83 | | - * and the attribute value being a string representation of the parameter value. |
84 | 49 | * |
85 | | - * @example someval |
86 | | - * @example 55 |
87 | | - * |
88 | | - * @note If a parameter has no name and instead is referenced only by index, then |
89 | | - * <key> **SHOULD** be the 0-based index. If `db.query.text` is also captured, then |
90 | | - * `db.operation.parameter.<key>` **SHOULD** match up with the parameterized placeholders |
91 | | - * present in db.query.text |
92 | | - * |
93 | | - * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
| 50 | + * @deprecated Removed, no replacement at this time. |
94 | 51 | */ |
95 | | -export const ATTR_DB_OPERATION_PARAMETER = 'db.operation.parameter'; |
| 52 | +export const ATTR_DB_USER = 'db.user' as const; |
96 | 53 |
|
97 | 54 | /** |
98 | | - * Username for accessing the database. |
| 55 | + * Enum value "oracle.db" for attribute {@link ATTR_DB_SYSTEM_NAME}. |
| 56 | + * |
| 57 | + * [Oracle Database](https://www.oracle.com/database/) |
99 | 58 | * |
| 59 | + * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
100 | 60 | */ |
101 | | -export const ATTR_DB_USER = 'db.user'; |
| 61 | +export const DB_SYSTEM_NAME_VALUE_ORACLE_DB = 'oracle.db' as const; |
0 commit comments