-
Notifications
You must be signed in to change notification settings - Fork 89
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
Clarify wording on SUBSCRIBE/GET to a non-existent path. #144
base: master
Are you sure you want to change the base?
Conversation
rpc/gnmi/gnmi-specification.md
Outdated
@@ -1400,8 +1402,10 @@ the current data tree on the server. While the path within the subscription | |||
SHOULD be a valid path within the set of schema modules that the target | |||
supports, subscribing to any syntactically valid path within such modules MUST | |||
be allowed. In the case that a particular path does not (yet) exist, the target | |||
MUST NOT close the RPC, and instead should continue to monitor for the existence | |||
of the path, and transmit telemetry updates should it exist in the future. | |||
would send just a `sync_response` for `ONCE` and `POLL` subscriptions, but MUST |
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.
I think the word "would" ought to be MUST, though I also think this might be clearer to make two different statements for the two different cases, and make it clearer how this applies when you're subscribing to multiple paths, some of which exist and some of which don't. For example, maybe:
When a
GET
orPOLL
subscription includes paths that do not (yet) exist in the data tree, the target MUST NOT include those paths in its response (for example, aGET
for exclusively paths that don't exist should return aSubscriptionResponse
that does not contain any updates).
When a
STREAM
subscription includes paths that do not (yet) exist in the data tree, the target MUST continue to monitor for the existence of those paths, and transmit telemetry updates should any of them exist in the future. In particular, aSTREAM
subscription consisting solely of paths that are not in the current data tree MUST NOT close the RPC, but instead should continue monitoring in case those paths are created later on.
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.
One question: By default, a STREAM starts by sending a notification of the current state; I assume in the case that none of the subscribed paths are set it should still send this notification, it just won't contain any updates?
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.
I'm happy with your modification, although I assume by GET
you mean ONCE
?
One question: By default, a STREAM starts by sending a notification of the current state; I assume in the case that none of the subscribed paths are set it should still send this notification, it just won't contain any updates?
This is also my understanding from https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#3523-sending-telemetry-updates
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.
Oh sorry, yes, I meant ONCE.
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.
This LGTM, but one question here -- was the clarification that sync_response
was not required something that was intended to be removed in the edit.
I can see a structure like:
For subscriptions that exclusively contain paths that do not (yet) exist in the data tree:
- for
ONCE
- target sends no
Notifications
since there are no values set. - target sends
sync_response
- target closes RPC
- target sends no
- for
STREAM
- Target sends no
Notifications
since there are no values set - target sends
sync_response
- target keeps RPC open and monitors for the paths - sending
Notifications
when they appear.
- Target sends no
On the clarification w.r.t whether notifications are sent for unset paths in a STREAM
subscription -- if a path isn't set a Notification
isn't sent -- i.e., we don't expect to send a notification to say something was nil
, so that there is consistent behaviour whether you're in this initial sync or not.
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.
Ok, updated to say that sync_response
is expected as the first message, PTAL.
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.
@gcsl Can you give us your review?
@@ -917,7 +917,9 @@ The `GetResponse` message consists of: | |||
and hence MUST NOT collapse data from multiple paths into a single | |||
`Notification` within the response. The `timestamp` field of the | |||
`Notification` message MUST be set to the time at which the target's | |||
snapshot of the relevant path was taken. | |||
snapshot of the relevant path was taken. If the path is syntactically valid | |||
but does not (yet) exist, then the `update` field of the `Notification` MUST |
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.
I think here the target should respond with an error using the NotFound
status code. This seems (to me) to be the most explicit thing to do when a client is explicitly asking for a very particular path.
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.
Wouldn't this deviate from Subscribe where no error is produced?
There is no requirement that the path specified in the message must exist within the current data tree on the server. While the path within the subscription SHOULD be a valid path within the set of schema modules that the target supports, subscribing to any syntactically valid path within such modules MUST be allowed. In the case that a particular path does not (yet) exist, the target MUST NOT close the RPC, and instead should continue to monitor for the existence of the path, and transmit telemetry updates should it exist in the future.
@@ -1400,8 +1402,10 @@ the current data tree on the server. While the path within the subscription | |||
SHOULD be a valid path within the set of schema modules that the target | |||
supports, subscribing to any syntactically valid path within such modules MUST | |||
be allowed. In the case that a particular path does not (yet) exist, the target | |||
MUST NOT close the RPC, and instead should continue to monitor for the existence | |||
of the path, and transmit telemetry updates should it exist in the future. | |||
would send a `sync_response` as the very first message to indicate this, and in |
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.
I still don't like this wording.
I suggest:
In the case that a particular path does not (yet) exist, the target should:
* For `ONCE` subscriptions, return a `sync_response` and close the RPC.
* For `POLL` subscriptions, return a `sync_response` immediately, and await the next polling request from the client.
* For `STREAM` subscriptions, if there is no data at a particular path at the start of a subscription, or when a path is sampled, the target should return a `sync_response` immediately. Should the path be created at some later time, the target should begin to transmit updates for the path, according to the specified mode of the subscription.
Thoughts?
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.
I like it. One question on a previous sentence:
subscribing to any syntactically valid path within such modules
So, if the path is not schema-compliant, it should return NOT_FOUND
? i.e. https://pkg.go.dev/google.golang.org/grpc/codes#Code
Should we document this as well?
See discussion at #142 (comment)