|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +/** |
| 18 | + * The name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn't provide a name, instrumentation **SHOULD** use a combination of parameters that would make the name unique, for example, combining attributes `server.address`, `server.port`, and `db.namespace`, formatted as `server.address:server.port/db.namespace`. Instrumentations that generate connection pool name following different patterns **SHOULD** document it. |
| 19 | + * |
| 20 | + * @example myDataSource |
| 21 | + * |
| 22 | + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
| 23 | + */ |
| 24 | +export const ATTR_DB_CLIENT_CONNECTION_POOL_NAME = |
| 25 | + 'db.client.connection.pool.name'; |
| 26 | + |
| 27 | +/** |
| 28 | + * The state of a connection in the pool |
| 29 | + * |
| 30 | + * @example idle |
| 31 | + * |
| 32 | + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
| 33 | + */ |
| 34 | +export const ATTR_DB_CLIENT_CONNECTION_STATE = 'db.client.connection.state'; |
| 35 | + |
| 36 | +/** |
| 37 | + * The name of the database, fully qualified within the server address and port. |
| 38 | + * |
| 39 | + * @example customers |
| 40 | + * @example test.users |
| 41 | + * |
| 42 | + * @note If a database system has multiple namespace components, they **SHOULD** be concatenated (potentially using database system specific conventions) from most general to most specific namespace component, and more specific namespaces **SHOULD NOT** be captured without the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid. |
| 43 | + * Semantic conventions for individual database systems **SHOULD** document what `db.namespace` means in the context of that system. |
| 44 | + * It is **RECOMMENDED** to capture the value as provided by the application without attempting to do any case normalization. |
| 45 | + * This attribute has stability level RELEASE CANDIDATE. |
| 46 | + * |
| 47 | + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
| 48 | + */ |
| 49 | +export const ATTR_DB_NAMESPACE = 'db.namespace'; |
| 50 | + |
| 51 | +/** |
| 52 | + * The name of the operation or command being executed. |
| 53 | + * |
| 54 | + * @example findAndModify |
| 55 | + * @example HMSET |
| 56 | + * @example SELECT |
| 57 | + * |
| 58 | + * @note It is **RECOMMENDED** to capture the value as provided by the application without attempting to do any case normalization. |
| 59 | + * If the operation name is parsed from the query text, it **SHOULD** be the first operation name found in the query. |
| 60 | + * 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. |
| 61 | + * This attribute has stability level RELEASE CANDIDATE. |
| 62 | + * |
| 63 | + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
| 64 | + */ |
| 65 | +export const ATTR_DB_OPERATION_NAME = 'db.operation.name'; |
| 66 | + |
| 67 | +/** |
| 68 | + * Enum value "used" for attribute {@link ATTR_DB_CLIENT_CONNECTION_STATE}. |
| 69 | + */ |
| 70 | +export const DB_CLIENT_CONNECTION_STATE_VALUE_USED = 'used'; |
| 71 | + |
| 72 | +/** |
| 73 | + * Enum value "idle" for attribute {@link ATTR_DB_CLIENT_CONNECTION_STATE}. |
| 74 | + */ |
| 75 | +export const DB_CLIENT_CONNECTION_STATE_VALUE_IDLE = 'idle'; |
| 76 | + |
| 77 | +/** |
| 78 | + * The number of connections that are currently in state described by the `state` attribute |
| 79 | + * |
| 80 | + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
| 81 | + */ |
| 82 | +export const METRIC_DB_CLIENT_CONNECTION_COUNT = 'db.client.connection.count'; |
| 83 | + |
| 84 | +/** |
| 85 | + * The number of current pending requests for an open connection |
| 86 | + * |
| 87 | + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
| 88 | + */ |
| 89 | +export const METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS = |
| 90 | + 'db.client.connection.pending_requests'; |
| 91 | + |
| 92 | +/** |
| 93 | + * Duration of database client operations. |
| 94 | + * |
| 95 | + * @note Batch operations **SHOULD** be recorded as a single operation. |
| 96 | + * |
| 97 | + * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. |
| 98 | + */ |
| 99 | +export const METRIC_DB_CLIENT_OPERATION_DURATION = |
| 100 | + 'db.client.operation.duration'; |
0 commit comments