-
Notifications
You must be signed in to change notification settings - Fork 571
feat(instrumentation-tls): wrap tls.connect API #447
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
Merged
vmarchaud
merged 19 commits into
open-telemetry:main
from
svrnm:tls-library-instrumentation
May 7, 2021
Merged
Changes from 12 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1ff9f9d
feat(instrumentation-tls): wrap tls.connect API
svrnm 54315fa
Merge branch 'main' into tls-library-instrumentation
svrnm 326d0a8
style: remove unused import for connect.test.ts in tls plugin
svrnm dddc0fc
Merge branch 'tls-library-instrumentation' of github.com:svrnm/opente…
svrnm baeb05d
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
svrnm c5d9f44
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
svrnm 81bd589
feat(instrumentation-tls): move tls instrumentation into net package
svrnm 5588ff0
feat(instrumentation-tls): remove comment in net.ts
svrnm 2a5f840
Merge branch 'main' into tls-library-instrumentation
svrnm 67b52d4
Merge branch 'main' of https://github.com/open-telemetry/opentelemetr…
svrnm 4d9fdad
feat(instrumentation-tls): fix stalled tests
svrnm 01c13d4
Merge branch 'tls-library-instrumentation' of github.com:svrnm/opente…
svrnm 198dbee
feat(instrumentation-tls): restructure tls tests and fix tests for al…
svrnm d6a3f50
feat(instrumentation-tls): fix style
svrnm 6b40e75
feat(instrumentation-tls): add comment that TLSAttributes are not off…
svrnm 1353d56
Merge branch 'main' into tls-library-instrumentation
svrnm 08ac436
Merge branch 'main' into tls-library-instrumentation
svrnm 62def9f
Merge branch 'main' into tls-library-instrumentation
svrnm 9e9c55d
Merge branch 'main' into tls-library-instrumentation
svrnm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict'; | ||
|
||
const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api'); | ||
const { NodeTracerProvider } = require('@opentelemetry/node'); | ||
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http'); | ||
const { NetInstrumentation } = require('@opentelemetry/instrumentation-net'); | ||
const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns'); | ||
const { registerInstrumentations } = require('@opentelemetry/instrumentation'); | ||
const { SimpleSpanProcessor, ConsoleSpanExporter } = require('@opentelemetry/tracing'); | ||
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); | ||
|
||
const provider = new NodeTracerProvider(); | ||
|
||
provider.addSpanProcessor(new SimpleSpanProcessor(new JaegerExporter({ | ||
serviceName: 'http-client', | ||
}))); | ||
|
||
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); | ||
|
||
provider.register(); | ||
|
||
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ALL); | ||
|
||
registerInstrumentations({ | ||
instrumentations: [ | ||
new NetInstrumentation(), | ||
new HttpInstrumentation(), | ||
new DnsInstrumentation({ | ||
// Avoid dns lookup loop with http zipkin calls | ||
ignoreHostnames: ['localhost'], | ||
}), | ||
], | ||
tracerProvider: provider, | ||
}); | ||
|
||
require('net'); | ||
require('dns'); | ||
const https = require('https'); | ||
const http = require('http'); | ||
|
||
http.get('http://opentelemetry.io/', () => {}).on('error', (e) => { | ||
console.error(e); | ||
}); | ||
|
||
https.get('https://opentelemetry.io/', () => {}).on('error', (e) => { | ||
console.error(e); | ||
}); | ||
|
||
https.get('https://opentelemetry.io/', { ca: [] }, () => {}).on('error', (e) => { | ||
console.error(e); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "tls-example", | ||
"private": true, | ||
"version": "0.15.0", | ||
"description": "Example of NET & TLS integration with OpenTelemetry", | ||
"main": "index.js", | ||
"scripts": { | ||
"zipkin:client": "cross-env EXPORTER=zipkin node ./client.js", | ||
"jaeger:client": "cross-env EXPORTER=jaeger node ./client.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]/open-telemetry/opentelemetry-js-contrib.git" | ||
}, | ||
"keywords": [ | ||
"opentelemetry", | ||
"net", | ||
"tls", | ||
"tracing" | ||
], | ||
"engines": { | ||
"node": ">=8.5.0" | ||
}, | ||
"author": "OpenTelemetry Authors", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/open-telemetry/opentelemetry-js-contrib/issues" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.18.1", | ||
"@opentelemetry/exporter-jaeger": "^0.18.2", | ||
"@opentelemetry/exporter-zipkin": "^0.18.2", | ||
"@opentelemetry/instrumentation": "^0.18.2", | ||
"@opentelemetry/instrumentation-net": "file:../../plugins/node/opentelemetry-instrumentation-net", | ||
"@opentelemetry/instrumentation-http": "^0.19.0", | ||
"@opentelemetry/instrumentation-dns": "^0.15.0", | ||
"@opentelemetry/node": "^0.18.2", | ||
"@opentelemetry/tracing": "^0.18.2" | ||
}, | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib#readme", | ||
"devDependencies": { | ||
"cross-env": "^6.0.3" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are any of these in the 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.
Not that I am aware of. I checked the specs and didn't find them there
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would be great
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.
@dyladan I found a bunch of them. There's four different cases:
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.