| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| def __init__(self, project=None, credentials=None, | ||
| http=None, use_gax=True): | ||
| super(Client, self).__init__(project, credentials, http) | ||
| self.use_gax = use_gax |
|
Not sure this will cause coverage to go below 100% because the branches are all implicit in one-line or statements. But I can see the branches. So pretty please write some unit tests? Also update the logging Client docstring with the new argument (pretty sure Pylint will get mad about that). |
Sorry, something went wrong.
|
What does this add that the DISABLE_GRPC envar doesn't do? Could the workaround just be setting that to True? |
Sorry, something went wrong.
|
@daspecster It's a manual override, since the gRPC client is b0rken (see the issue that @waprin linked to). |
Sorry, something went wrong.
|
@daspecster Yes but error reporting currently uses the logging client, it doesn't seem right for one module to be forcing a global environment variable. |
Sorry, something went wrong.
|
Yeah I looked at the issues. If this gets added, then we may want to set a reminder/issue to take it out once the bug in gRPC is resolved right? |
Sorry, something went wrong.
Currently gax can’t log nested structs, so this is a workaround to allow forced HTTP logging.
|
@dhermes added unit test and coverage passes. |
Sorry, something went wrong.
|
|
||
|
|
||
| class TestClient(unittest.TestCase): | ||
|
|
| return wrapped | ||
|
|
||
| class _GaxLoggingAPI(object): | ||
|
|
|
|
||
|
|
||
| class _DummyLoggingAPI(object): | ||
|
|
Sorry, something went wrong.
|
@waprin I think a few things should happen:
|
Sorry, something went wrong.
|
@dhermes SGTM, will just re-purpose this PR |
Sorry, something went wrong.
| version=None): | ||
| self.logging_client = google.cloud.logging.client.Client( | ||
| project, credentials, http) | ||
| project=project, credentials=credentials, http=http, use_gax=False) |
|
|
||
| :type use_gax: bool or :class:`NoneType` | ||
| :param use_gax: An optional parameter that explicitly specifies whether | ||
| to use the gRPC transport (gax) or HTTP |
|
|
||
| with _Monkey(MUT, _USE_GAX=False): | ||
| client = self._makeOne(self.PROJECT, credentials=_Credentials()) | ||
| conn = client.connection = object() |
|
|
||
| creds = _Credentials() | ||
| with _Monkey(MUT, | ||
| _USE_GAX=True): |
| def test_no_gax_ctor(self): | ||
| from google.cloud.logging.connection import _LoggingAPI | ||
| from google.cloud.logging import client as MUT | ||
| from google.cloud._testing import _Monkey |
| ``http`` object is created that is bound to the | ||
| ``credentials`` for the current object. | ||
|
|
||
| :type use_gax: bool or :class:`NoneType` |
| ``credentials`` for the current object. | ||
|
|
||
| :type use_gax: bool or :class:`NoneType` | ||
| :param use_gax: An optional parameter that explicitly specifies whether |
| conn = client.connection = object() | ||
|
|
||
| with _Monkey(MUT, _USE_GAX=False): | ||
| client = self._makeOne(project=self.PROJECT, credentials=creds) |
| conn = client.connection = object() | ||
|
|
||
| with _Monkey(MUT, _USE_GAX=False): | ||
| client = self._makeOne(project=self.PROJECT, credentials=creds) |
There was a problem hiding this comment.
LGTM (merge squash in the UI once Travis is green?)
Sorry, something went wrong.
|
@dhermes yes please squash merge at your convienence |
Sorry, something went wrong.
Allows Explicitly Enabling/Disabling GAX for Logging/Pubsub
Allows Explicitly Enabling/Disabling GAX for Logging/Pubsub
Allows Explicitly Enabling/Disabling GAX for Logging/Pubsub
| Back | FazBrowse Home | New Git URL |
Currently gax can’t log nested structs, so this is a workaround to allow forced HTTP logging.
Workaround to resolve #2521 until #2552 is resolved.