Skip to content

Conversation

@yuvipanda
Copy link
Contributor

To enable JSON detection in StackDriver, jsonPayload should
have no fields other than message. This patch lets clients
opt-in to this behavior, by creating a custom Transport.

Fixes #5799

@yuvipanda yuvipanda requested a review from crwilcox as a code owner October 23, 2018 21:11
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 23, 2018
}

if self._include_logger_name:
log_record['info']['python_logger'] = record.name

This comment was marked as spam.

This comment was marked as spam.


def enqueue(self, record, message, resource=None, labels=None,
trace=None, span_id=None):
trace=None, span_id=None, include_logger_name=True):

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

@tseaver tseaver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need test coverage for the case where the user disables adding the logger name.

To enable JSON detection in StackDriver, `jsonPayload` should have no fields other than `message`. This patch lets clients opt-in to this behavior, by creating a custom Transport. Fixes #5799
@yuvipanda
Copy link
Contributor Author

Thanks for the comments, @crwilcox! Fixed.

@tseaver will add those shortly.

@yuvipanda
Copy link
Contributor Author

@tseaver added tests and they seem to pass!

yuvipanda added a commit to yuvipanda/mybinder.org-deploy that referenced this pull request Oct 25, 2018
This patch sends events (currently, just launches) to stackdriver. The events aren't parsed as JSON by stackdriver yet, but that should be fixed by googleapis/google-cloud-python#6293. You can find the events under 'Global -> binderhub-events-text'.
@crwilcox crwilcox added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 25, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 25, 2018
@yuvipanda
Copy link
Contributor Author

@crwilcox I found linting errors from @kokoro-team, and pushed a fix! Thanks

@tseaver tseaver added api: logging Issues related to the Cloud Logging API. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Oct 25, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 25, 2018
@yuvipanda
Copy link
Contributor Author

I missed one lint failure, fixed now. Would be easier if lint ran on CircleCI or something earlier.

@crwilcox
Copy link
Contributor

Hi @yuvipanda . Thanks for the PR. Something 'funny' is going on with the test runs on GitHub right now. You should see a series of tests happening for this, but none are showing. We will need to sort that out before merging.

@yuvipanda
Copy link
Contributor Author

@crwilcox are these the @kokoro-team tests or something else? Anything I can do?

grace_period = 50
max_batch_size = 50
max_latency = 0.1
include_logger_name = True

This comment was marked as spam.

This comment was marked as spam.

worker = self._make_one(
logger, grace_period=grace_period, max_batch_size=max_batch_size,
max_latency=max_latency)
max_latency=max_latency, include_logger_name=include_logger_name)

This comment was marked as spam.

This comment was marked as spam.

self.assertEqual(worker._grace_period, grace_period)
self.assertEqual(worker._max_batch_size, max_batch_size)
self.assertEqual(worker._max_latency, max_latency)
self.assertEqual(worker._include_logger_name, include_logger_name)

This comment was marked as spam.

This comment was marked as spam.

@crwilcox crwilcox added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 26, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 26, 2018
@tseaver tseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 26, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 26, 2018
@tseaver
Copy link
Contributor

tseaver commented Oct 26, 2018

@crwilcox I believe your comments have been addressed. CI is green, so merge when ready.

@crwilcox crwilcox merged commit d72f443 into googleapis:master Oct 26, 2018
@crwilcox
Copy link
Contributor

Thank you @yuvipanda for the contribution!

@yuvipanda
Copy link
Contributor Author

Awesome! Thank you very much, @crwilcox and @tseaver. Do you know when the next release to PyPI will be?

@yuvipanda yuvipanda deleted the patch-1 branch October 27, 2018 04:15
yuvipanda added a commit to yuvipanda/binderhub that referenced this pull request Oct 29, 2018
Includes googleapis/google-cloud-python#6293. Lets us push structured logs to stackdriver, rather than textual logs.
tseaver added a commit that referenced this pull request Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: logging Issues related to the Cloud Logging API. cla: yes This human has signed the Contributor License Agreement.

5 participants