-
Notifications
You must be signed in to change notification settings - Fork 580
feat(instrumentation-knex): Use newer semantic conventions #2671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
f6f9e4c
aef24d6
53585cb
ff6e0bf
b40ba4d
88fb85c
8a78e1f
f48f01e
2a85075
a8d4c05
4810f90
5499bd9
4e43e12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,9 +54,9 @@ registerInstrumentations({ | |
|
||
## Semantic Conventions | ||
|
||
This package uses `@opentelemetry/semantic-conventions` version `1.27+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md) | ||
This package uses `@opentelemetry/semantic-conventions` version `1.33+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md) | ||
|
||
This package is capable of emitting both Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md) and [Version 1.32.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.32.0/docs/database/database-metrics.md) | ||
This package is capable of emitting both Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md) and [Version 1.33.0](https://github.com/open-telemetry/semantic-conventions/blob/v1.33.0/docs/database/database-metrics.md) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you intend to link the database metrics doc page? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, both have the tags ;) I'll link to |
||
It is controlled using the environment variable `OTEL_SEMCONV_STABILITY_OPT_IN`, which is a comma separated list of values. | ||
The values `database` and `database/dup` control this instrumentation. | ||
See details for the behavior of each of these values below. | ||
|
@@ -73,42 +73,19 @@ When upgrading to the new semantic conventions, it is recommended to do so in th | |
|
||
This will cause both the old and new semantic conventions to be emitted during the transition period. | ||
|
||
### ### Legacy Behavior (default) | ||
|
||
Enabled when `OTEL_SEMCONV_STABILITY_OPT_IN` contains `database/dup` or DOES NOT CONTAIN `database`. | ||
|
||
Attributes collected: | ||
|
||
| Attribute | Short Description | | ||
| ----------------------- | ------------------------------------------------------------------------------ | | ||
| `db.name` | This attribute is used to report the name of the database being accessed. | | ||
| `db.operation` | The name of the operation being executed. | | ||
| `db.sql.table` | The name of the primary table that the operation is acting upon. | | ||
| `db.statement` | The database statement being executed. | | ||
| `db.system` | An identifier for the database management system (DBMS) product being used. | | ||
| `db.user` | Username for accessing the database. | | ||
| `net.peer.name` | Remote hostname or similar. | | ||
| `net.peer.port` | Remote port number. | | ||
| `net.transport` | Transport protocol used. | | ||
|
||
### RC Semantic Conventions 1.32 | ||
|
||
Enabled when `OTEL_SEMCONV_STABILITY_OPT_IN` contains `database` OR `database/dup`. | ||
This is the recommended configuration, and will soon become the default behavior. | ||
|
||
Attributes collected: | ||
|
||
| Attribute | Short Description | | ||
|----------------------|-----------------------------------------------------------------------------| | ||
| `db.namespace` | This attribute is used to report the name of the database being accessed. | | ||
| `db.operation.name` | The name of the operation being executed. | | ||
| `db.collection.name` | The name of the primary table that the operation is acting upon. | | ||
| `db.query.text` | The database statement being executed. | | ||
| `db.system` | An identifier for the database management system (DBMS) product being used. | | ||
| `db.user` | Username for accessing the database. | | ||
| `server.address` | Remote hostname or similar. | | ||
| `server.port` | Remote port number. | | ||
| `network.transport` | Transport protocol used. | | ||
| v1.7.0 semconv | v1.23.0 semconv | Short Description | | ||
|-----------------|----------------------|-----------------------------------------------------------------------------| | ||
| `db.name` | `db.namespace` | This attribute is used to report the name of the database being accessed. | | ||
| `db.operation` | `db.operation.name` | The name of the operation being executed. | | ||
| `db.sql.table` | `db.collection.name` | The name of the primary table that the operation is acting upon. | | ||
| `db.statement` | `db.query.text` | The database statement being executed. | | ||
| `db.system` | `db.system.name` | An identifier for the database management system (DBMS) product being used. | | ||
| `db.user` | (not included) | Username for accessing the database. | | ||
| `net.peer.name` | `server.address` | Remote hostname or similar. | | ||
| `net.peer.port` | `server.port` | Remote port number. | | ||
| `net.transport` | (not included) | Transport protocol used. | | ||
|
||
## Useful links | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ import { Exception } from '@opentelemetry/api'; | |
import { | ||
DB_SYSTEM_NAME_VALUE_POSTGRESQL, | ||
DB_SYSTEM_NAME_VALUE_SQLITE, | ||
} from './semconv'; | ||
} from '@opentelemetry/semantic-conventions'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To use tl;dr: (Eventually semconv-related things will settle down and this won't be so hard/obtuse/subtle.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Perhaps easiest to wait for a v1.33.1 release of the semconv package, then create the src/semconv.ts again (perhaps using the https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/scripts/gen-semconv-ts.js tool). I'm happy to help with that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'll wait for the release, anyway I have no idea why they are still experimental as it's pretty much a given that sqlite is sqlite |
||
|
||
type KnexError = Error & { | ||
code?: string; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General note on semconv docs in instrumentation READMEs. Jamie and I have been recently working through some
OTEL_SEMCONV_STABILITY_OPT_IN
support for http-related instrumentation. If you like there is some boilerplate here that you could copy:https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/opentelemetry-instrumentation-http/README.md?plain=1#L73
For example, it merges the attributes for "old" and "stable" into a single table.
However, what you have here is fine, so no need to adjust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take another look at it tomorrow, as I'm somehow not satisfied with the current fixed version, yet I can't tell what bothers me there.