eclipse-sparkplug / sparkplug

Sparkplug
Eclipse Public License 2.0
115 stars 39 forks source link

Redundant dataType field? #215

Closed Llorx closed 2 years ago

Llorx commented 2 years ago

For me, it looks redundant to send again the dataType for each metric on each DDATA message, as it was already sent with the metrics on the DBIRTH message.

I don't know if is optional, but I can't see something about that on https://github.com/eclipse/sparkplug/blob/develop/specification/src/main/asciidoc/chapters/Sparkplug_6_Payloads.adoc

Genoil commented 2 years ago

If you create an alias for the metric on DBIRTH, subsequent DDATA for that metric can consist of just the alias and the value. But the primary node / SCADA or whatever consumes your payloads should then support reconstructing the name and type based on that alias. At least that is how I have understood the spec. I haven't seen an open source implementation that does this. Mine does.

Llorx commented 2 years ago

As per spec, the alias is only tied to the name, not the type:

optional uint64   alias         = 2;        // Metric alias - tied to name on birth and included in all later DATA messages

And just noticed this:

The datatype SHOULD NOT be included with metric definitions in NDATA, NCMD, DDATA, and DCMD messages.

So yeah, is already on the spec. Going to remove it to save a bit of bandwidth.

Thank you. I just needed to read more in depth. My bad xD