-
Notifications
You must be signed in to change notification settings - Fork 805
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(grpc-js): add @grpc/grpc-js plugin #1201
feat(grpc-js): add @grpc/grpc-js plugin #1201
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1201 +/- ##
==========================================
+ Coverage 92.37% 92.69% +0.32%
==========================================
Files 181 193 +12
Lines 4378 4804 +426
Branches 922 982 +60
==========================================
+ Hits 4044 4453 +409
- Misses 334 351 +17
|
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.
just first pass as the pr is big
packages/opentelemetry-plugin-grpc-js/src/server/clientStreamAndUnary.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-plugin-grpc-js/src/server/patchServer.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-plugin-grpc-js/src/server/patchServer.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-plugin-grpc-js/src/client/patchClient.ts
Outdated
Show resolved
Hide resolved
.map(methodName => methods[methodName].originalName) | ||
.filter( | ||
originalName => | ||
// eslint-disable-next-line no-prototype-builtins |
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.
should we disable this rule completely ?
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.
Hm, do you mean for the entire project? I am not opposed... I think the only benefit it has for this project is to gently discourage using builtins unless necessary
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.
we are patching many things, so I guess this might be not needed rule at all for this project, this is just my thought :)
what's happened to unit tests ? |
The API layers between |
…nto feat/add-grpc-js-plugin
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.
have 2 questions yet, but it lgtm
super('@opentelemetry/plugin-grpc-js', VERSION); | ||
} | ||
|
||
protected patch(): typeof grpcJs { | ||
throw new Error('Method not implemented.'); | ||
this.tracer = this._tracer; |
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.
should this be somehow unpatched in unpatch
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.
Good point. This would be to prevent a dangling reference on this reference right? I've added jsdoc comment to their declarations and nulled them out here via
(this.tracer as Tracer | null) = null;
(this.logger ...) = null
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 don't think a dangling reference here is a big deal as there can only ever be one of them. If there was a new reference on each call to patch then maybe it would be a problem.
@open-telemetry/javascript-approvers ^^ |
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.
Added suggestions around slices for copying an object, which we can change to use the spread operator instead, which has been supported since node 5. See https://node.green/#ES2015-syntax-spread-syntax-for-iterable-objects
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
): void { | ||
let spanEnded = false; | ||
const endSpan = () => { | ||
if (!spanEnded) { |
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'm thinking that we should expose a property on the SDK's span that represent if the span has been ended. There are few plugins that implement something like this which add memory overhead for nothing, WDYT ?
@sk- thanks for your thorough review :) |
… becoming an owner (open-telemetry#1201) * chore(instrumentation-graphql): turn off failing test and releases * chore: keep releasing GraphQL * chore: fix wording on readme * chore: apply @dyladan's suggestions Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Which problem is this PR solving?
Short description of the changes
Not a lot of "new" code here. Most of it is copied or moved over from the existing
grpc
plugin.@grpc/grpc-js
library@opentelemetry/grpc-utils
private
package which contains shared test suite that will be used by@opentelemetry/plugin-grpc
/@opentelemetry/plugin-grpc-js
. This code is what was previously ingrpc.test.ts
.grpc
and@grpc/grpc-js
and they could further diverge in the future.