feat(instrumentation-tls): wrap tls.connect API#447
feat(instrumentation-tls): wrap tls.connect API#447vmarchaud merged 19 commits intoopen-telemetry:mainfrom
Conversation
…lemetry-js-contrib into tls-library-instrumentation
Codecov Report
@@ Coverage Diff @@
## main #447 +/- ##
==========================================
+ Coverage 95.20% 95.25% +0.05%
==========================================
Files 130 134 +4
Lines 8148 8385 +237
Branches 788 812 +24
==========================================
+ Hits 7757 7987 +230
- Misses 391 398 +7
|
obecny
left a comment
There was a problem hiding this comment.
first pass, why the test coverage went down so much ?
Maybe consider adding the tls under net plugin ? |
|
Patching the same thing twice for different instrumentations with shimmer it is tricky as unpatching cannot be done then @open-telemetry/javascript-approvers replacing shimmer sooner or later is inevitable. I have mentioned this year ago, worth to mention it again, it will work fine with |
|
|
@obecny I figured out a way to combine TLS into the .net package (like http instrumentation does both http and https) I am not 100% sure how this works: the attributes for TLS (like cipher and certificate details) are not unique to Node.JS of course. If I understand it correctly, they might be a candidate for semantic-attributes, which are defined through the specification, right? |
There indeed defined at the spec level (here for trace and here for resources) which we then use to code-gen our package (here), you should open an issue there to be able to "standardize" them for all SDKs. In the mean time, i think you can keep the one you used |
|
Tests are timing out after 360 minutes. i'm going to manually trigger them again but if they time out again you probably have something to look into. |
Thanks. I saw this issue but couldn’t figure out yet why this happens. I’ll try to reproduce it locally and come up with a fix. |
…lemetry-js-contrib into tls-library-instrumentation
| SECURE_CONNECT = 'secureConnect', | ||
| } | ||
|
|
||
| export enum TLSAttributes { |
There was a problem hiding this comment.
Are any of these in the Semantic Conventions?
There was a problem hiding this comment.
Not that I am aware of. I checked the specs and didn't find them there
There was a problem hiding this comment.
can you add a comment that these are not "official"
we need guidance from the spec how to add attributes that are not yet specified. If the spec eventually adds one of these attributes and it isn't compatible with ours that will be a problem.
@open-telemetry/technical-committee any guidance how to handle this?
There was a problem hiding this comment.
Sorry, I was confused. I thought you talk about the socket events, but you mean the TLSAttributes? I actually opened an issue already: open-telemetry/opentelemetry-specification#1652
can you add a comment that these are not "official"
Yes, I can do that.
I guess they are not the only candidates for that, e.g. the DNS package puts the name that was looked up into net.peer.name, which is probably not correct and their might be a semantic convention for DNS.
Since this is kind of related to open-telemetry/opentelemetry-js#2123: Would it help if I scan js and js-contrib (semi)automatically for attributes that are either in the semantic-specs already or that might be candidates for it?
There was a problem hiding this comment.
@dyladan I found a bunch of them. There's four different cases:
- Use of existing semantic conventions (like PG, see Fix semantic conventions for PG and PG Pool #467)
- Use of potentially new semantic conventions, I mean things that are used outside of node.js as well (DNS, TLS, graphQL)
- Use of custom attributes specific to the instrumented library (express, hapi, restify)
- A corner case are browser specific attributes: while those are "unique" to javascript I would still argue that they should be covered by a semantic convention, since they are still universal
Since this is a discussion unrelated to this ticket, can you give me some guidance where to move this discussion? Open another issue with the specification repo?
There was a problem hiding this comment.
I would open an issue on this repo to track it at least. If you think some should be spec'd then you should open an issue on the spec repo too and link them.
…l nodejs versions
|
Sorry for triggering the tests multiple times, I assumed no issues with node:10 and node:8, hope it's fixed now... |
Which problem is this PR solving?
This PR is addressing the instrumentation request at #292
Short description of the changes
Open Questions
For whatever reason I needed to use
prependOnceListenerto get the instrumentation for thesecureConnectevent working. I didn't run into any issues with that, but maybe someone can double check?This package has a kind of dependency on the "net" plugin. Since both instrument the connect method of the socket I had to add a workaround to make both work at the same time. I am not super happy with that solution: I check in the isWrapped conditional for the name of the existing wrapper and if it is 'patchedConnect' I save it and apply it later in a "chained" fashion. Is there already an approach for dependencies?