census-instrumentation / opencensus-python

A stats collection and distributed tracing framework
Apache License 2.0
669 stars 250 forks source link

Error for "requests" integration is misleading #125

Closed bshaffer closed 6 years ago

bshaffer commented 6 years ago

Following the instructions for integrating requests results in the following error:

WARNING:opencensus.trace.config_integration:Failed to integrate module: requests, supported integrations are httplib, mysql, postgresql, pymysql, requests, sqlalchemy

This is because the docs say request but it should be httplib

wkiser commented 6 years ago

Both requests and httplib integrations are supported (just tested it out). Are you sure that you have the requests package installed? It looks like there is a generic error for failing to add an integration.

bshaffer commented 6 years ago

Ahh, that must be it. Thank you!

I would then suggest changing this issue to be a more descriptive error message.

liyanhui1228 commented 6 years ago

Yes both the requests and httplib integrations are supported, and the possible reason could be requests module not installed like @wkiser said. Yeah thanks for the feedback, I was intending to not break user's application when integrating with the libraries so I made the exception generic, will make a change to output more meaningful error message.

bshaffer commented 6 years ago

I've installed and imported the requests module but I am still getting the error

wkiser commented 6 years ago

Hey @bshaffer , can you paste a gist of the code you are trying to execute and the output of pip freeze? Are you running from source or from a package installed from pypi?

bshaffer commented 6 years ago

@wkiser

Here is my code: https://github.com/bshaffer/faceswap-app/blob/v2/worker/worker.py

And here is the output of pip freeze: https://gist.github.com/bshaffer/9014f0ae21a06fca0005994780d1f6a1

liyanhui1228 commented 6 years ago

Per discussion with @bshaffer, this is caused by wrapt package not installed and cloud firestore is using grpc as transport layer instead of requests. And the opencensus cloud clientlibs integration does not support wrapping the grpc channel from code path google.api_core.grpc_helpers.create_channel. PR #131 is for adding that support.