-
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
Pubsub message timestamp broken #1623
Comments
Thanks @ptone, you are our best bug-filer! Do you have a stacktrace / code snippet to trigger the error? |
FWIW, the
Support for generating the attiribute was added to If I had been aware of the |
@tseaver Does this mean a change is on the way? |
I can appreciate the good will of trying to capture a best practice into the class definition. But I think these sort of sweetners should be called out explicitly in general, and in this case there is an unfortunate semantic conflict with the resource originated I think there are going to be times you need to preserve strict order from the publisher environment, but I would have rather named the convention for the attribute something like "user_timestamp" - there is nothing about this provided by the service. If you have well coordinated clocks among a set of publishers, the user_timestamp will be more reliable than publishTime - which is going to be an internal service-side time, and is really best effort based on arrival time. It is poorly named, as it is really internalPublishTime between one part of PubSub and another. I don't have any particularly strong opinion about how to "fix" the semantic conflict here - but I do hope we can see the resource property exposed in the Message class. |
I'm not sure. The simplest change would be to expose a read-only |
Do you have anything roughly approximating this: I would rename .timestamp to .user_timestamp, keep the old property wrapped in a deprecation warning, and change the docs for anyone coming in for the first time. Then you can make clear in the docs the difference between the two timestamps |
While we are |
I think we should just remove any manually added timestamp since the API supports it. Though @ptone seems to imply the backend's timestamps might not be reliable? |
The message timestamp for pubsub is fully broken - it is looking for the timestamp in a message attribute, but per the docs, it is a primary field of the message resource.
https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/pubsub/message.py#L51
the docs - clearly reference in source comments point to where the timestamp actually is:
https://cloud.google.com/pubsub/reference/rest/v1/PubsubMessage
In API explorer, here is the returned value:
The text was updated successfully, but these errors were encountered: