-
Notifications
You must be signed in to change notification settings - Fork 579
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
feat(instrumentation-knex): Use newer semantic conventions #2671
Conversation
This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature. |
7b91bdc
to
3a70ffe
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2671 +/- ##
==========================================
+ Coverage 89.63% 89.67% +0.03%
==========================================
Files 184 185 +1
Lines 9003 9014 +11
Branches 1845 1849 +4
==========================================
+ Hits 8070 8083 +13
+ Misses 933 931 -2
🚀 New features to boost your workflow:
|
I'll sponsor. |
@maryliag I'd appreciate your guidance here. Part of this PR is updating some Is that something we should be doing now? Or is that something we should wait on until after the semconv v1.33.0 release because of the pending stabilization of db semconv: https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.32.0 says:
Do you know if there will be a |
@trentm as far as I recall knex is already behind other modules regarding the attributes, so I don't see much of an issue making these changes opt-in. |
I think it's okay to do them now, because we don't plan on making any other changes to them, at least not in the ones that were updated here. Regarding the opt-in, we do have some guidance on this on semantic convention pages already: Existing database instrumentations that are using v1.24.0 of this document (or prior):
So, I would say you can make the changes now, but with an opt-in for the new names and still sending old values, then create an issue to remove the old names on a following version, just to make sure we keep track of this and don't forget |
|
5184085
to
0fe75a2
Compare
@maryliag can you merge it or should I ping someone? |
cc @trentm |
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:
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.
plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Trent Mick <[email protected]>
* Bump semantic-conventions to ^1.33.0 * Update used attributes to stabilised ones
DB_SYSTEM_NAME_VALUE_SQLITE, | ||
} from './semconv'; | ||
} from '@opentelemetry/semantic-conventions'; |
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.
To use DB_SYSTEM_NAME_VALUE_SQLITE
will require using a local src/semconv.ts
soon. See:
open-telemetry/opentelemetry-js#5690 (comment)
tl;dr: DB_SYSTEM_NAME_VALUE_SQLITE
is actually unstable and should not have been included in the stable @opentelemetry/semantic-conventions
entry point.
(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 comment
The reason will be displayed to describe this comment to others. Learn more.
To use
DB_SYSTEM_NAME_VALUE_SQLITE
will require using a localsrc/semconv.ts
soon.
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 comment
The 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
This package uses `@opentelemetry/semantic-conventions` version `1.22+`, 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.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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, both have the tags ;) I'll link to database-spans.md
when 1.33.1 comes out
plugins/node/opentelemetry-instrumentation-knex/src/instrumentation.ts
Outdated
Show resolved
Hide resolved
Use semconvStabilityFromStr from @opentelemetry/instrumentation, to avoid duplicating code.
@trentm frankly, I'm stumped why it started failing after the change |
I think you are right. Good find!
The lint step is failing because you need to now do:
That is assuming you'd rather not go back to a local/internal |
No problem, I'll wait - someone has to test things ;) As for the linter - I didn't even look at this being occupied with the previous error. |
…um` to `enum` to allow single-file transpilation tooling to work with code that uses `SemconvStability` Refs: open-telemetry#5691 Refs: open-telemetry/opentelemetry-js-contrib#2671 (comment)
My write-up: open-telemetry/opentelemetry-js#5691 It being Friday afternoon, this will likely sit until Monday. |
Ok, I've updated everything now. |
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.
LGTM after the suggested package-lock edits.
"@opentelemetry/api-logs": { | ||
"version": "0.201.1", | ||
"resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.201.1.tgz", | ||
"integrity": "sha512-IxcFDP1IGMDemVFG2by/AMK+/o6EuBQ8idUq3xZ6MxgQGeumYZuX5OwR0h9HuvcUc/JPjQGfU5OHKIKYDJcXeA==", | ||
"requires": { | ||
"@opentelemetry/api": "^1.3.0" | ||
} | ||
}, | ||
"@opentelemetry/instrumentation": { | ||
"version": "0.201.1", | ||
"resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.201.1.tgz", | ||
"integrity": "sha512-6EOSoT2zcyBM3VryAzn35ytjRrOMeaWZyzQ/PHVfxoXp5rMf7UUgVToqxOhQffKOHtC7Dma4bHt+DuwIBBZyZA==", | ||
"requires": { | ||
"@opentelemetry/api-logs": "0.201.1", | ||
"@types/shimmer": "^1.2.0", | ||
"import-in-the-middle": "^1.8.1", | ||
"require-in-the-middle": "^7.1.1", | ||
"shimmer": "^1.2.1" | ||
} | ||
}, |
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.
"@opentelemetry/api-logs": { | |
"version": "0.201.1", | |
"resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.201.1.tgz", | |
"integrity": "sha512-IxcFDP1IGMDemVFG2by/AMK+/o6EuBQ8idUq3xZ6MxgQGeumYZuX5OwR0h9HuvcUc/JPjQGfU5OHKIKYDJcXeA==", | |
"requires": { | |
"@opentelemetry/api": "^1.3.0" | |
} | |
}, | |
"@opentelemetry/instrumentation": { | |
"version": "0.201.1", | |
"resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.201.1.tgz", | |
"integrity": "sha512-6EOSoT2zcyBM3VryAzn35ytjRrOMeaWZyzQ/PHVfxoXp5rMf7UUgVToqxOhQffKOHtC7Dma4bHt+DuwIBBZyZA==", | |
"requires": { | |
"@opentelemetry/api-logs": "0.201.1", | |
"@types/shimmer": "^1.2.0", | |
"import-in-the-middle": "^1.8.1", | |
"require-in-the-middle": "^7.1.1", | |
"shimmer": "^1.2.1" | |
} | |
}, |
package-lock.json updating sucks. There are multiple layouts of deps that satisfy a given set of package.json files. The one you currently have on this PR duplicates some packages to plugins/node/opentelemetry-instrumentation-knex/node_modules
that don't need to be there. This happened because you added a dep on @opentelemetry/[email protected]
in this subdir when the top-level still depended on version 0.201.0
. Then #2835 updated the dep to version 0.201.1
at the top-level.
A subsequent npm install
does not clean this up. npm dedupe
does clean this up -- at least this case -- but running that on the current repo state also changes the install location of a few other packages, which doesn't belong on this PR.
Instead, I'll suggest a few manual deletions to package-lock.json to clean it up manually.
(The alternative is to revert package-lock.json to the state on main, then run:
cd plugins/node/opentelemetry-instrumentation-knex
npm install
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.
Yes, I'm obsessing. :) It would be fine to merge this as is and later (or not) run npm dedupe.
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.
In fact, let's just do that.
"@types/shimmer": { | ||
"version": "1.2.0", | ||
"resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.2.0.tgz", | ||
"integrity": "sha512-UE7oxhQLLd9gub6JKIAhDq06T0F6FnztwMNRvYgjeQSBeMc1ZG/tA47EwfduvkuQS8apbkM/lpLpWsaCeYsXVg==" | ||
}, |
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.
"@types/shimmer": { | |
"version": "1.2.0", | |
"resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.2.0.tgz", | |
"integrity": "sha512-UE7oxhQLLd9gub6JKIAhDq06T0F6FnztwMNRvYgjeQSBeMc1ZG/tA47EwfduvkuQS8apbkM/lpLpWsaCeYsXVg==" | |
}, |
"plugins/node/opentelemetry-instrumentation-knex/node_modules/@types/shimmer": { | ||
"version": "1.2.0", | ||
"resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.2.0.tgz", | ||
"integrity": "sha512-UE7oxhQLLd9gub6JKIAhDq06T0F6FnztwMNRvYgjeQSBeMc1ZG/tA47EwfduvkuQS8apbkM/lpLpWsaCeYsXVg==", | ||
"license": "MIT" | ||
}, |
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.
"plugins/node/opentelemetry-instrumentation-knex/node_modules/@types/shimmer": { | |
"version": "1.2.0", | |
"resolved": "https://registry.npmjs.org/@types/shimmer/-/shimmer-1.2.0.tgz", | |
"integrity": "sha512-UE7oxhQLLd9gub6JKIAhDq06T0F6FnztwMNRvYgjeQSBeMc1ZG/tA47EwfduvkuQS8apbkM/lpLpWsaCeYsXVg==", | |
"license": "MIT" | |
}, |
"plugins/node/opentelemetry-instrumentation-knex/node_modules/@opentelemetry/api-logs": { | ||
"version": "0.201.1", | ||
"resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.201.1.tgz", | ||
"integrity": "sha512-IxcFDP1IGMDemVFG2by/AMK+/o6EuBQ8idUq3xZ6MxgQGeumYZuX5OwR0h9HuvcUc/JPjQGfU5OHKIKYDJcXeA==", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@opentelemetry/api": "^1.3.0" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0" | ||
} | ||
}, | ||
"plugins/node/opentelemetry-instrumentation-knex/node_modules/@opentelemetry/instrumentation": { | ||
"version": "0.201.1", | ||
"resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.201.1.tgz", | ||
"integrity": "sha512-6EOSoT2zcyBM3VryAzn35ytjRrOMeaWZyzQ/PHVfxoXp5rMf7UUgVToqxOhQffKOHtC7Dma4bHt+DuwIBBZyZA==", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@opentelemetry/api-logs": "0.201.1", | ||
"@types/shimmer": "^1.2.0", | ||
"import-in-the-middle": "^1.8.1", | ||
"require-in-the-middle": "^7.1.1", | ||
"shimmer": "^1.2.1" | ||
}, | ||
"engines": { | ||
"node": "^18.19.0 || >=20.6.0" | ||
}, | ||
"peerDependencies": { | ||
"@opentelemetry/api": "^1.3.0" | ||
} | ||
}, |
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.
"plugins/node/opentelemetry-instrumentation-knex/node_modules/@opentelemetry/api-logs": { | |
"version": "0.201.1", | |
"resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.201.1.tgz", | |
"integrity": "sha512-IxcFDP1IGMDemVFG2by/AMK+/o6EuBQ8idUq3xZ6MxgQGeumYZuX5OwR0h9HuvcUc/JPjQGfU5OHKIKYDJcXeA==", | |
"license": "Apache-2.0", | |
"dependencies": { | |
"@opentelemetry/api": "^1.3.0" | |
}, | |
"engines": { | |
"node": ">=8.0.0" | |
} | |
}, | |
"plugins/node/opentelemetry-instrumentation-knex/node_modules/@opentelemetry/instrumentation": { | |
"version": "0.201.1", | |
"resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.201.1.tgz", | |
"integrity": "sha512-6EOSoT2zcyBM3VryAzn35ytjRrOMeaWZyzQ/PHVfxoXp5rMf7UUgVToqxOhQffKOHtC7Dma4bHt+DuwIBBZyZA==", | |
"license": "Apache-2.0", | |
"dependencies": { | |
"@opentelemetry/api-logs": "0.201.1", | |
"@types/shimmer": "^1.2.0", | |
"import-in-the-middle": "^1.8.1", | |
"require-in-the-middle": "^7.1.1", | |
"shimmer": "^1.2.1" | |
}, | |
"engines": { | |
"node": "^18.19.0 || >=20.6.0" | |
}, | |
"peerDependencies": { | |
"@opentelemetry/api": "^1.3.0" | |
} | |
}, |
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.
LGTM.
I'll follow up with a separate npm dedupe
PR.
Thanks for doing this @deejay1!
Which problem is this PR solving?
Short description of the changes
SpanAttributes
call withAttributes