-
Notifications
You must be signed in to change notification settings - Fork 230
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
fix: added support for Opentelemetry 0.18 #1234
Conversation
Introduces support for Opentelemetry 0.18 API which implements the Tracing 1.0 specification.
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
Codecov Report
@@ Coverage Diff @@
## master #1234 +/- ##
==========================================
+ Coverage 97.80% 97.84% +0.04%
==========================================
Files 26 26
Lines 12642 12700 +58
Branches 611 607 -4
==========================================
+ Hits 12364 12426 +62
+ Misses 273 268 -5
- Partials 5 6 +1
Continue to review full report at Codecov.
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent |
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.
Question to the maintainers here, can we remove enableOpenTelemetryTracing
option altogether?
Enabling instrumentation in OpenTelemetry should be done by
- User adding a dependency on the SDK (instead of just the API)
@opentelemetry/tracing
(which is why @weyert has moved it out ofdependencies
) - User configuring the global tracer provider to the SDK
TracerProvider
as is done here:provider.register();
An alternative is the user can pass a tracer provider instance as an option, otherwise we get the global one.
If the user doesn't take those steps, the @opentelemetry/api
package will give no-op implementations that don't do anything. It should be implicit
@@ -223,7 +192,15 @@ describe('Publisher', () => { | |||
opentelemetry.trace.setGlobalTracerProvider(provider); | |||
|
|||
tracingPublisher.publish(buffer); | |||
assert.ok(exporter.getFinishedSpans()); | |||
const spans = exporter.getFinishedSpans(); |
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.
Nice this looks better
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, the problem is that it wasn't checking if it had a span so it always was successful (even now in master) if I change this to check the length >= 1 it will fail.
Only I am not well versed in this library or its tests to see were the issue is. It does like that _constructSpan always exits early due the first if-statement.
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.
So its still not creating a span with the current code?
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.
Yeah, I tried it a minute ago and it looks like it's still not getting any spans. I thought maybe it's because you have to add a tracer, but that doesn't seem to have changed it. I don't know much about OT either :)
Slightly unrelated: assert.equal
shows up as deprecated for me, and it suggests assert.strictEqual
.
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 a look
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.
@weyert I'll open a PR to your fork. I think my original suggestions were too lofty, I want to sync up with the pubsub folks before changing things too much.
Small refactor to ensure no new tracer gets created for each call to the `createSpan`-functio by initiating the `libraryTracer`-variable
Thanks for all the code and comments, I appreciate it... I haven't really known what to do with the OT support since the APIs changed. It was an outside contribution, so none of us know that API too well. So to answer @aabmass 's comment, I'm open to guidance on where to take it over time. Busy day today, I'll look at this in a bit! :) |
Yes, the API shouldn't really happen anymore as the API is 1.0.0 now and it shouldn't change much anymore and I think only backward compatible changes are allowed and 1.0.0 will be supported for a few years. The Currently, I have upgraded to 0.18 and tried to remove the dependency to the |
@weyert the test failure looks to be related to globals and things running before this test. If I only run that case with I think depending when @feywind wants to make more changes, we should change things a bit. If we alter the configuration here and remove So for now @weyert, lets maybe leave the config in and just upgrade the library to 0.18? |
Thanks for trying this out! I didn't think about trying this out!
Sounds good, so the change to Sorry, I haven't had a change yet to look into it today. |
Hmm you mentioned it was broken before this PR too so maybe that won't fix it :/ but its worth a try |
We talked over the package.json thing, I think that's probably not going to change for now, but we might do something to make it more abstracted/standardized. I'd like to do it separately if we can get a clean build on this, though. |
That makes totally sense! :) |
package.json
Outdated
@@ -38,7 +38,7 @@ | |||
"clean": "gts clean", | |||
"compile": "tsc -p . && cp -r protos build/", | |||
"compile-protos": "compileProtos src", | |||
"prepare": "npm run compile-protos && npm run compile && rm ./build/package.json", | |||
"prepare": "npm run compile-protos && npm run compile", |
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 you would need to revert the change from require
to import
approach for loading package.json
. I don't think removing this is enough
I'm a little bit confused, this branch now works and builds for me just fine locally. Actually removing the |
Most important that it works now :D Yeah confusing indeed. |
Any news? |
Not yet, sorry. I'm going to just retry it again for good measure, in case it was a (long lasting) transient error. I don't think anything is wrong with the code at this point. |
@weyert On my local machine, I did manage to get this part of the process to fail, but it was a different failure. I'm not sure why |
If you run it locally, what kind of output does the issues
|
Awesome! Thank you for merging :D |
🤖 I have created a release \*beep\* \*boop\* --- ## [2.11.0](https://www.github.com/googleapis/nodejs-pubsub/compare/v2.10.0...v2.11.0) (2021-04-14) ### ⚠ BREAKING CHANGES * fix: added support for Opentelemetry 0.18 - makes significant changes to OpenTelemetry support in order to unblock its usage again; the main user-visible change is that you will need to use 0.18+ versions of OpenTelemetry, and different items are passed to the server in spans. ### Bug Fixes * added support for Opentelemetry 0.18 ([#1234](https://www.github.com/googleapis/nodejs-pubsub/issues/1234)) ([aedc36c](https://www.github.com/googleapis/nodejs-pubsub/commit/aedc36c3f8736eff1cb781b9e05457463481b3d6)) * follow-on proto updates from the removal of the common protos ([#1229](https://www.github.com/googleapis/nodejs-pubsub/issues/1229)) ([cb627d5](https://www.github.com/googleapis/nodejs-pubsub/commit/cb627d5555c617eb025181c9f9aaf1d2c9621a86)) * prevent attempt to publish 0 messages ([#1218](https://www.github.com/googleapis/nodejs-pubsub/issues/1218)) ([96e6535](https://www.github.com/googleapis/nodejs-pubsub/commit/96e653514b35d61f74ba2d5d6fa96e19bc45bf8c)) * remove common protos ([#1232](https://www.github.com/googleapis/nodejs-pubsub/issues/1232)) ([8838288](https://www.github.com/googleapis/nodejs-pubsub/commit/883828800c94f7ea21c8306d272b70b4576c664c)) * reverting the major from the OpenTelemetry change (it was already broken) ([#1257](https://www.github.com/googleapis/nodejs-pubsub/issues/1257)) ([09c428a](https://www.github.com/googleapis/nodejs-pubsub/commit/09c428a17eb20fcd0fc45301addb48d2bebc56a3)) * temporarily pin sinon at 10.0.0 ([#1252](https://www.github.com/googleapis/nodejs-pubsub/issues/1252)) ([0922164](https://www.github.com/googleapis/nodejs-pubsub/commit/09221643be0693463ed4e5d56efd0f1ebfbe78b7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
* Change mutate to match veneer Changed the test proxy functionality to match what is in the veneer layer and now the test case in question passes with a slight change in the grpc code returned. * Shorten the parsing of entries in the test proxy This commit just permits a more concise expression for the entries that should be returned back to the test runner. * Changes to test proxy proto The test proxy uses a new test path now so these adjustments must be made to work with the test runner properly. * Revert "Changes to test proxy proto" This reverts commit efbdadbfdcb96d4135d211617207ed2524648b04. * Pass error along as is As per the online discussion, we should simply pass along the error as is so that the corresponding error message and status can be reported.
Introduces support for Opentelemetry 0.18 API which implements the
Tracing 1.0 specification.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #1233 🦕