-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Logging: Unique Writer Identity #4595
Logging: Unique Writer Identity #4595
Conversation
231df62
to
39e4567
Compare
@@ -211,13 +212,22 @@ def sink_create(self, project, sink_name, filter_, destination): | |||
:type destination: str | |||
:param destination: destination URI for the entries exported by | |||
the sink. | |||
|
|||
:type unique_writer_identity: bool |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Looks mostly good, I just have nitpicks (and one relevant docs change)
logging/google/cloud/logging/_gax.py
Outdated
""" | ||
options = None | ||
parent = 'projects/%s' % (project,) | ||
sink_pb = LogSink(name=sink_name, filter=filter_, | ||
destination=destination) | ||
uwi = unique_writer_identity |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
logging/google/cloud/logging/_gax.py
Outdated
self._gax_api.create_sink(parent, | ||
sink_pb, | ||
unique_writer_identity=uwi, | ||
options=options) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
logging/google/cloud/logging/sink.py
Outdated
@@ -40,11 +40,13 @@ class Sink(object): | |||
:param client: A client which holds credentials and project configuration | |||
for the sink (which requires a project). | |||
""" | |||
def __init__(self, name, filter_=None, destination=None, client=None): | |||
def __init__(self, name, filter_=None, destination=None, client=None, | |||
unique_writer_identity=False): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
logging/google/cloud/logging/sink.py
Outdated
@@ -116,7 +118,9 @@ def create(self, client=None): | |||
""" | |||
client = self._require_client(client) | |||
client.sinks_api.sink_create( | |||
self.project, self.name, self.filter_, self.destination) | |||
self.project, self.name, self.filter_, self.destination, | |||
self._unique_writer_identity |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
logging/tests/unit/test__gax.py
Outdated
@@ -40,6 +40,7 @@ class _Base(object): | |||
PROJECT = 'PROJECT' | |||
PROJECT_PATH = 'projects/%s' % (PROJECT,) | |||
FILTER = 'logName:syslog AND severity>=ERROR' | |||
UNIQUE_WRITER_IDENTITY = True |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -737,7 +738,7 @@ def test_sink_create_ok(self): | |||
api.sink_create( | |||
self.PROJECT, self.SINK_NAME, self.FILTER, self.DESTINATION_URI) | |||
|
|||
parent, sink, options = ( | |||
parent, sink, options, unique_writer_identity = ( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
logging/tests/unit/test__gax.py
Outdated
api = self._make_one(gax_api, None) | ||
api.sink_create( | ||
self.PROJECT, self.SINK_NAME, self.FILTER, self.DESTINATION_URI, | ||
self.UNIQUE_WRITER_IDENTITY |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
logging/tests/unit/test__gax.py
Outdated
self.assertEqual(sink.name, self.SINK_NAME) | ||
self.assertEqual(sink.filter, self.FILTER) | ||
self.assertEqual(sink.destination, self.DESTINATION_URI) | ||
self.assertEqual(unique_writer_identity, self.UNIQUE_WRITER_IDENTITY) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
logging/tests/unit/test__http.py
Outdated
api = self._make_one(client) | ||
|
||
api.sink_create( | ||
self.PROJECT, self.SINK_NAME, self.FILTER, self.DESTINATION_URI, True) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
logging/tests/unit/test__http.py
Outdated
path = '/projects/%s/sinks' % (self.PROJECT,) | ||
self.assertEqual(conn._called_with['path'], path) | ||
self.assertEqual(conn._called_with['data'], SENT) | ||
self.assertEqual(conn._called_with['query_params'], {'uniqueWriterIdentity': True}) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
d4bcf59
to
9063794
Compare
- Dropping a `uwi` alias for a long variable name - Making line continuations a bit more "uniform" (e.g. a single value per line) - Making sure to always pass a keyword argument as a keyword - Dropping a long class scalar that is just an alias for the `True` literal
9063794
to
105d327
Compare
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were 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 here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
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.
LGTM
#4578 Not sure if this is right, but an attempt.