openconfig/reference

Encoding for telemetry updates

Closed this issue · 3 comments

gNMI spec section 3.5 says telemetry updates should be encoded as (path, scalar value) pairs.

When aggregation is not permitted by the client or the schema each update message MUST contain a (key, value) pair - where the key MUST be a path to a single leaf element within the data tree (encoded according to Section 2.2.2). The value MUST encode only the value of the leaf specified. In most cases, this will be a scalar value (i.e., a JSON value if a JSON encoding is utilised)...

By "scalar value" is it referring to scalar types as explained in section 2.2.3? The very next sentence says "a JSON value if a JSON encoding is utilised"; hence the confusion. The ygot.TogNMINotifications utility encodes the updates using scalar types.

@aashaikh, @robshakir -- can you please clarify this?
Thanks

By "scalar types", I'm going to guess the authors mean a TypedValue, https://github.com/openconfig/gnmi/blob/master/proto/gnmi/gnmi.proto#L107, which can also hold JSON (bytes json_val = 10;).

TogNMINotifications only supports marshalling to non-JSON TypedValue types, so perhaps "scalar values" can be interpreted to mean those non-JSON types, but strictly I think the term "scalar value" might be too ambiguous here.

gcsl commented

Scalar value refers to the value of an individual leaf so as to disambiguate from a sub-branch with multiple leaves. In a majority of cases, this is the expectation as there are likely cases where the timestamps for multiple leaves in a container are not guaranteed to be the same depending on how they are collected from a given hardware implementation. Aggregation was envisioned only for select circumstances (e.g. where a branch of leaves modeled in OC are actually a single payload at the protocol layer such as an IS-IS LSP).