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
Copy file name to clipboardExpand all lines: packages/instrumentation-pg/README.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,48 @@ PostgreSQL instrumentation has few options available to choose from. You can set
51
51
|`requireParentSpan`|`boolean`| If true, requires a parent span to create new spans (default false) |
52
52
|`addSqlCommenterCommentToQueries`|`boolean`| If true, adds [sqlcommenter](https://github.com/open-telemetry/opentelemetry-sqlcommenter) specification compliant comment to queries with tracing context (default false). _NOTE: A comment will not be added to queries that already contain `--` or `/* ... */` in them, even if these are not actually part of comments_|
53
53
54
+
## Semantic Conventions
55
+
56
+
Prior to version `0.55.0`, this instrumentation created spans and metrics targeting an experimental semantic convention Version 1.27.0.
57
+
58
+
Database semantic conventions (semconv) were stabilized in v1.34.0, and a [migration process](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/non-normative/db-migration.md) was defined.
59
+
`@opentelemetry/instrumentation-pg` versions 0.55.0 and later include support for migrating to stable Database semantic conventions, as described below.
60
+
The intent is to provide an approximate 6 month time window for users of this instrumentation to migrate to the new Database semconv, after which a new minor version will use the new semconv by default and drop support for the old semconv.
61
+
62
+
To select which semconv version(s) is emitted from this instrumentation, use the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable.
63
+
64
+
-`database`: emit the new (stable) v1.34.0+ semantics
65
+
-`database/dup`: emit **both** the old v1.27.0 and the new (stable) v1.34.0+ semantics
66
+
- By default, if `OTEL_SEMCONV_STABILITY_OPT_IN` includes neither of the above tokens, the old v1.27.0 semconv is used.
67
+
68
+
### Attributes collected
69
+
70
+
| v1.27.0 semconv | v1.34.0 semconv | Short Description |
* 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
25
*
@@ -22,7 +28,7 @@
22
28
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
* The name of the database, fully qualified within the server address and port.
55
+
* Deprecated, use `db.namespace` instead.
38
56
*
39
57
* @example customers
40
-
* @example test.users
58
+
* @example main
59
+
*
60
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
41
61
*
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.
62
+
* @deprecated Replaced by `db.namespace`.
63
+
*/
64
+
exportconstATTR_DB_NAME='db.name'asconst;
65
+
66
+
/**
67
+
* The database statement being executed.
68
+
*
69
+
* @example SELECT * FROM wuser_table
70
+
* @example SET mykey "WuValue"
46
71
*
47
72
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
* The name of the operation or command being executed.
79
+
* Deprecated, use `db.system.name` instead.
80
+
*
81
+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
53
82
*
54
-
* @example findAndModify
55
-
* @example HMSET
56
-
* @example SELECT
83
+
* @deprecated Replaced by `db.system.name`.
84
+
*/
85
+
exportconstATTR_DB_SYSTEM='db.system'asconst;
86
+
87
+
/**
88
+
* Deprecated, no replacement at this time.
57
89
*
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.
90
+
* @example readonly_user
91
+
* @example reporting_user
62
92
*
63
93
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
94
+
*
95
+
* @deprecated Removed, no replacement at this time.
0 commit comments