-
Notifications
You must be signed in to change notification settings - Fork 824
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: exporter collector TLS option #1063
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1063 +/- ##
=======================================
Coverage 95.12% 95.12%
=======================================
Files 213 213
Lines 8950 8951 +1
Branches 806 806
=======================================
+ Hits 8514 8515 +1
Misses 436 436
|
Certs exist only for testing purposes yes? If so they should be in the test directory. |
Good point, fixed. Let me know if you have any other comments. |
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
@@ -0,0 +1,11 @@ | |||
rm ca.crt ca.key client.crt client.csr client.key server.crt server.csr server.key |
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 please add some comments or documentation on what this file does, when it should be run, why it is here?
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.
sure, would this document be a good place 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.
Don't think so. That file is for general contribution guidelines and things that apply to the whole repository, not a specific package. I would just add it as comments to the top of this file, and/or add a note in the collector exporter readme.
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.
Got it, thanks.
@@ -49,6 +49,32 @@ provider.register(); | |||
|
|||
``` | |||
|
|||
By default, plaintext connection is used. In order to use TLS, provide `credentials` option like so: |
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.
Please add a note similar to "to see how to generate credentials, you can refer to the script used to generate certificates for tests [here](link to certs sh)."
@obecny would like to get your eyes on 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.
I think this needs to be refactored into specific platforms
import { ExportResult, NoopLogger } from '@opentelemetry/core'; | ||
import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing'; | ||
import { Attributes, Logger } from '@opentelemetry/api'; | ||
import * as grpc from 'grpc'; |
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.
CollectorExporter is used by web and node. grpc is not part of web so this won't be working fine and also credentials are not needed in web so far.
I think ExporterCollector should be treated as base class and not be exported (outside - only internally). Then inside folder platform inside node and browser you should create a new files ExporterCollector. The web can simply return the "base" ExporterCollector but the node you can then simply extend the base with all needed functionality that you added here. Then export the extended class correctly
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 understand the credentials will only work in node, but it won't break web right?
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.
it will break as grpc
is a node package, cannot be included into web
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.
unless we just let credentials to exists in both, but then explain that you should not use it which might be misleading why. By splitting this it will be easier to add stuff I think
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.
It is type only and is compiled away. In recent versions of ts there is even a way to enforce this by doing import type { ChannelCredentials } from 'grpc';
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 affraid that once we allow having anything from grpc here it is like asking for more trouble in future - who will remember then that we should not do that. Splitting this now will save us troubles later and it will be easier to maintain it too.
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.
@obecny I've refactored it as you suggested. Please check if web/node exports are done correctly, I'm not sure I understand the initial idea with separate exports for each env. Let me know if you have any other comments.
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.
Also if you wanna do any changes yourself - feel free to push.
@@ -49,6 +49,34 @@ provider.register(); | |||
|
|||
``` | |||
|
|||
By default, plaintext connection is used. In order to use TLS, provide `credentials` option like so: | |||
```js |
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.
please mark this is for node only, not browser
Codecov Report
@@ Coverage Diff @@
## master #1063 +/- ##
==========================================
- Coverage 95.17% 95.17% -0.01%
==========================================
Files 216 216
Lines 9063 9062 -1
Branches 819 819
==========================================
- Hits 8626 8625 -1
Misses 437 437
|
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.
the changes lgtm, I checked if it works fine and there was just one bug with web version - added comment.
There is one thing which can be now changed / refactored. This is with regards to platform/node/CollectorExporter.ts line 32
traceServiceClients = ...
it was needed before to have reference to Collector, now you could simply use this
as you have a Collector instance in place.
FYI if you want to test collector in web
- update lerna.json and add
"examples/collector-exporter-node",
"examples/tracer-web",
into packages
section - this is just temporary to be able to bootstrap and debug examples (don't commit this)
2. npm i
from root folder
3. npm run watch
from packages/opentelemetry-exporter-collector
4. npm run start
from examples/tracer-web
5. npm run docker:start
from examples/collector-exporter-node
6. Open page at http://localhost:8090/user-interaction/ and click some button to generate traces
7. Open page at http://localhost:9411/zipkin/ to check traces
packages/opentelemetry-exporter-collector/src/platform/node/CollectorExporter.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-collector/src/platform/node/CollectorExporter.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-collector/src/platform/node/CollectorExporter.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-collector/src/platform/node/CollectorExporter.ts
Outdated
Show resolved
Hide resolved
@obecny Thanks a lot for the detailed feedback! Fixed all the comments and checked as you suggested with web example - seems to work fine. Let me know if you have any other comments. |
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.
thx for all your work, looks gr8 :)
* fix(sendMessageBatch): add sqs test * fix(sendMessageBatch): remove unused parameter * fix(fix comment): fix comment
Resolves this: #1062