-
Notifications
You must be signed in to change notification settings - Fork 276
Add OpenCensus instrumentation for tracing #1926
Conversation
Seems like the library fails to contact Stackdriver API on the Travis CI test VM, do we have gcloud credentials set up on that VM ? Maybe we can just disable the |
…Stackdriver Trace
* Shorten import statements * Fix > 80 characters lines * Fix unittests by falling back on FileExporter
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
Codecov Report
@@ Coverage Diff @@
## dev #1926 +/- ##
==========================================
- Coverage 89.32% 89.28% -0.04%
==========================================
Files 165 166 +1
Lines 12154 12180 +26
==========================================
+ Hits 10856 10875 +19
- Misses 1298 1305 +7
|
I signed it ! I have configured the right email address for future. |
Please make this change aware of if the opencensus package is installed, if it is not installed it should be a no-op. For changes like this, where a new third party library is introduced for an optional feature, or a feature that can be disabled without impacting the rest of forseti, the code needs to fail back cleanly when that library is not installed. This happens to be the first new feature to be implemented where this would apply. |
We're planning on using OpenCensus for our monitoring as well. While tracing could be made optional and configurable, monitoring (exposing OpenCensus metrics to monitoring systems like Stackdriver) seems required for Forseti, so the dependency would be as well. Is there currently any way to add an optional dependency in Forseti deployments ? |
Forseti is both a deployment but also a set of libraries that are used elsewhere. Introducing additional third party dependencies makes the use of forseti libraries more difficult when a full deployment is not desired. I recommend wrapping the opencensus imports in the tracing module in a try catch, and setting a global to True or False depending on if they are available or not. Then the code can handle the cases where opencensus is installed or not installed by checking the value of that global, and you can fall back gracefully. |
…n / off (#2) * Add support for additional interceptors. * Add server CLI flag `--enable-tracing`. * Make tracing libraries optional. Install them using `pip install .[tracing]`. * Pass `--enable-tracing` in `systemctl` script (default toggle for deployments) * Add logging to exporter and tracer
@ahoying made some good points here. Users should be able to install the My last commit brings support for:
Please review and let me know what you 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.
Thank you for taking the extra time on this one to make it optional. Looks great, I think this is a solid pattern for other features.
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.
A couple of more comments.
* Clean up tracing * Fix logging error * Better imports for OpenCensus * Remove unused 'imp' import
Thanks for your in-depth review. I think I've addressed the above comments with my last commits. |
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.
This looks really great! Thank you so much for the work here! We will test it during our release process next week!
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.
Awesome, looking forward to having instrumentation!
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
This reverts commit 3ec2263.
This PR brings support for OpenCensus tracing for all gRPC Forseti services:
gRPC
server and clientcloudtrace.agent
to allow client/server VMs to write traces to Stackdriver (during deployment)