You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make optional MetricDataTypes either required or not allowed in DATA messages - don't allow them to be optional #449
Is there a plan for this? It seems that the examples in the 3.0.0 specification, the tahu reference implementations, and real production implementations all include datatype in the metrics of NDATA, DDATA, NCMD, and DCMD. Should / will this become a MUST or a MUST NOT in the future, or is it still undecided? Thanks.
@elcombs — apologies this went unanswered for two years. The short answer is that it is still undecided in practice, and your observation is the main reason.
Where it actually stands
A decision was recorded in the 4.0.0 features document: "MUST be included in BIRTH and MUST NOT in DATA — changes are covered by amended BIRTH messages." It was never implemented. The specification today says:
tck-id-payloads-metric-datatype-req — "The datatype MUST be included with each metric definition in NBIRTH and DBIRTH messages."
tck-id-payloads-metric-datatype-not-req — "The datatype SHOULD NOT be included with metric definitions in NDATA, NCMD, DDATA, and DCMD messages."
So it is SHOULD NOT, not MUST NOT. The decision and the text have been out of step the whole time.
Your point checks out, including against this specification's own examples
You noted that the 3.0.0 examples, the Tahu reference implementations and production implementations all include datatype in NDATA, DDATA, NCMD and DCMD. That is still true of the v4 draft: the DDATA example in Chapter 6, the one that shows a payload in both the Protocol Buffers and JSON encodings, carries "datatype": "Float" on its metric.
So the specification would be contradicting its own example if MUST NOT were adopted as recorded, and every implementation named above would become non-conforming on a field they have always sent.
That is not an argument that the decision is wrong — there is a real case for it, since a datatype in DATA is redundant once BIRTH has established it, and a disagreeing datatype in DATA is a genuine ambiguity the specification does not currently resolve. But it is an argument that the cost was not weighed when the decision was recorded.
Why this issue stays open rather than folding into #446
#446 is the general version of this question — which components of a metric are mandatory, by message type — and it is being worked as a component × message-type matrix. It was suggested that this issue be closed as a duplicate. It should not be, because it carries three things #446 does not: the recorded decision above, your objection, and the gap between the decision and the text.
Instead this is the first worked row of that matrix. It is the one field where a decision already exists and the ecosystem cost is already known, so settling it establishes how the rest are settled.
The decision needed
MUST in DATA, matching what implementations do, and resolve separately what a receiver does when a DATA datatype disagrees with the BIRTH.
MUST NOT as recorded, accepting that current implementations become non-conforming and that the chapter's own DDATA example has to change.
Leave SHOULD NOT, and state explicitly what a receiver does with a datatype that is present.
Option 3 is the status quo but is incomplete as written: a SHOULD NOT with no stated handling for the non-preferred case leaves a receiver without guidance, which is how this issue started.
Decision: a metric's datatype MUST be included in a BIRTH only. Implemented in #662.
That is option 2 from the comment above, taken with the ecosystem cost known. The specification had said SHOULD NOT since the decision was first recorded, so this closes the gap between the two.
Three things changed:
tck-id-payloads-metric-datatype-not-req is now a MUST NOT, and states why: the datatype is established by the NBIRTH or DBIRTH that defined the metric, and a change is published as an amended BIRTH.
The DDATA example in the JSON encoding section carried "datatype": "Float" on its metric, in both the spPv4.0 and spJv4.0 forms. The chapter was contradicting its own rule; both are corrected.
The TCK scored this through setShouldResult, which records a MAYBE rather than a failure. It now scores it as a MUST.
@elcombs — this is the answer to your question, two years on: MUST NOT. Your observation stands and was weighed: the Tahu reference implementations and production implementations do send a datatype in DATA, and they become non-conforming on this point. The reasoning for taking it anyway is that a datatype in DATA is redundant once BIRTH has established it, and a disagreeing datatype in DATA is an ambiguity the specification never resolved — removing the field removes the ambiguity rather than having to define it.
Still open
What a receiver does with a datatype that arrives anyway. A MUST NOT binds the publisher and says nothing about the consumer, and existing implementations will keep sending one for some time. A receiver that ignores it migrates gracefully; a receiver that rejects the message breaks every current implementation at once.
My expectation is "ignore it, and use the datatype from the BIRTH", but that is a second normative statement and a new assertion id, so it is left for the working group rather than folded into #662.
Leaving this issue open until that is settled. #446 continues as the general version of the question, with this as its first worked row.
Receiver side decided and implemented in #662 (8787ba6): ignore a matching datatype, reject the message if it differs.
payloads-metric-datatype-data-ignored — a consuming application MUST ignore a datatype carried in NDATA, DDATA, NCMD or DCMD where it equals the datatype established for that metric by the BIRTH that defined it.
payloads-metric-datatype-data-mismatch — where it differs, the application MUST reject the message and MUST NOT apply any metric value from it.
Both govern a non-conforming publisher, since a conforming one never sends a datatype in these messages at all.
Correcting the record on compatibility. My earlier comment weighed the cost to the Tahu reference implementations and production implementations that send a datatype in DATA. That was misplaced: Sparkplug 4 is unreleased and those are Sparkplug 3 implementations on spBv1.0, which this rule does not govern. There is no migration cost to weigh.
One thing still not covered
The rules say the message is rejected; they do not say what the Host does next. After a mismatch its BIRTH-established datatype is known to disagree with what the Edge Node is sending, and discarding the message alone leaves the two out of step indefinitely.
The specification's established answer to an inconsistency a Host cannot resolve is a Rebirth Request — that is what it does for an unresolved sequence gap. Pairing the rejection with one looks like the coherent completion, but it is a third normative statement and another assertion id, so it is not in #662.
Settled: a consuming application MUST send a Rebirth Request after rejecting a message for a datatype mismatch. Implemented in #662 (84d3b2f) as payloads-metric-datatype-data-mismatch-rebirth.
Rejecting alone left the two sides out of step — the consuming application's datatype for that metric is known to disagree with what the Edge Node is sending, and discarding the message does nothing about that. A Rebirth is the specification's existing answer to an inconsistency a Host cannot resolve, as it already is for an unresolved sequence gap, and it is the only mechanism for re-establishing a metric definition.
That closes the last open point. The rule is now complete on both sides:
Publisher
datatype MUST be in BIRTH, MUST NOT be in NDATA, DDATA, NCMD or DCMD
Receiver, matching datatype
MUST ignore it
Receiver, differing datatype
MUST reject the message, apply no metric value from it, and MUST send a Rebirth Request
#662 carries all of it, and this issue can close when that merges. #446 continues as the general mandatory/optional matrix, with this as its first worked row.
Split after a review pass found that the wider change could not be made coherently in one go. #662 is closed; its reasoning is recorded there.
[#449] A metric's datatype MUST NOT accompany a value in DATA #664 — the part of this issue that stands on its own: payloads-metric-datatype-not-req becomes a MUST NOT over NDATA and DDATA. NCMD and DCMD are excluded, because a Command invocation is identified by a metric datatype of Command. Three TCK corrections go with it: the check was scored through setShouldResult (a MAYBE, not a failure), the topic filter did not match the assertion, and the log text quoted the old wording.
The receiver rules — ignore a matching datatype, reject and rebirth on a differing one — are not carried forward yet. Two things have to be settled first:
The rebirth loop. NREBIRTH was in the rejection list, so an Edge Node that always sets the field gives reject, rebirth, reject, with no bound. My justification that this matches the response to a sequence gap was wrong: a Rebirth resolves a gap, but cannot resolve a publisher that always sets the field. Nothing bounds how often a Host Application may send Rebirth Requests #663 covers rate limiting but does not remove the loop from the normative text.
JSON.payloads-json-typedvalue-flat defines the single datatype key to be the TypedValue's, so a JSON Host Application can never observe a Metric datatype field and the rules can never fire. Nothing currently requires a reported value's datatype to agree with the definition, so the disagreement the rules exist to catch is ungoverned in that encoding.
#664 is merged as 32abf59. The narrow part of this issue is done:
payloads-metric-datatype-not-req is a MUST NOT over NDATA and DDATA in the Protocol Buffers encoding, replacing the SHOULD NOT that had been out of step with the recorded decision since it was taken.
NCMD and DCMD are excluded: a Command invocation is identified by a metric datatype of Command.
payloads-json-typedvalue-carries-both sets the TypedValue field only where the Metric datatype field is not permitted, so converting a conforming JSON payload no longer produces a non-conforming Protocol Buffers one.
Three TCK corrections: scored as a MUST through setResultIfNotFail rather than setShouldResult, the topic filter matched to the assertion, and the dead call from checkCommandTopicPayload removed.
Still open here: the receiver rules — ignore a datatype that matches the definition, reject and request a Rebirth where it differs. Two things have to be settled before they can land:
The Rebirth loop. As drafted in [#449] A Metric's datatype belongs in META, not alongside a value #662, NREBIRTH was itself in the rejection list, so an Edge Node that always sets the field gives reject, Rebirth, reject, with no bound. The justification offered at the time — that this matches the response to an unresolved sequence gap — does not hold: a Rebirth resolves a gap, but cannot resolve a publisher that always sets the field. Nothing bounds how often a Host Application may send Rebirth Requests #663 covers rate limiting generally but does not remove the loop from the normative text.
JSON.payloads-json-typedvalue-flat makes the single datatype key the TypedValue's, so a JSON Host Application never observes a Metric datatype field and the rules cannot fire there. Nothing currently requires a reported value's datatype to agree with the definition, so the disagreement the rules exist to catch is ungoverned in that encoding.
Separately, #665 carries the contradiction this issue kept running into: payloads-metric-datatype-req still requires the datatype in NBIRTH and DBIRTH against the Topics chapter's prohibition, SessionEstablishmentTest enforces that side so a conforming Edge Node fails the TCK today, Chapter 1 still states the pre-separation rule, and the same rules are duplicated across chapters. None of it is caused by this issue and none is fixed by #664.
Activity
elcombs commentedon Oct 25, 2024
Is there a plan for this? It seems that the examples in the 3.0.0 specification, the tahu reference implementations, and real production implementations all include datatype in the metrics of NDATA, DDATA, NCMD, and DCMD. Should / will this become a MUST or a MUST NOT in the future, or is it still undecided? Thanks.
wes-johnson commentedon Nov 25, 2026
@elcombs — apologies this went unanswered for two years. The short answer is that it is still undecided in practice, and your observation is the main reason.
Where it actually stands
A decision was recorded in the 4.0.0 features document: "MUST be included in BIRTH and MUST NOT in DATA — changes are covered by amended BIRTH messages." It was never implemented. The specification today says:
tck-id-payloads-metric-datatype-req— "The datatype MUST be included with each metric definition in NBIRTH and DBIRTH messages."tck-id-payloads-metric-datatype-not-req— "The datatype SHOULD NOT be included with metric definitions in NDATA, NCMD, DDATA, and DCMD messages."So it is
SHOULD NOT, notMUST NOT. The decision and the text have been out of step the whole time.Your point checks out, including against this specification's own examples
You noted that the 3.0.0 examples, the Tahu reference implementations and production implementations all include
datatypein NDATA, DDATA, NCMD and DCMD. That is still true of the v4 draft: the DDATA example in Chapter 6, the one that shows a payload in both the Protocol Buffers and JSON encodings, carries"datatype": "Float"on its metric.So the specification would be contradicting its own example if
MUST NOTwere adopted as recorded, and every implementation named above would become non-conforming on a field they have always sent.That is not an argument that the decision is wrong — there is a real case for it, since a datatype in DATA is redundant once BIRTH has established it, and a disagreeing datatype in DATA is a genuine ambiguity the specification does not currently resolve. But it is an argument that the cost was not weighed when the decision was recorded.
Why this issue stays open rather than folding into #446
#446 is the general version of this question — which components of a metric are mandatory, by message type — and it is being worked as a component × message-type matrix. It was suggested that this issue be closed as a duplicate. It should not be, because it carries three things #446 does not: the recorded decision above, your objection, and the gap between the decision and the text.
Instead this is the first worked row of that matrix. It is the one field where a decision already exists and the ecosystem cost is already known, so settling it establishes how the rest are settled.
The decision needed
MUSTin DATA, matching what implementations do, and resolve separately what a receiver does when a DATA datatype disagrees with the BIRTH.MUST NOTas recorded, accepting that current implementations become non-conforming and that the chapter's own DDATA example has to change.SHOULD NOT, and state explicitly what a receiver does with a datatype that is present.Option 3 is the status quo but is incomplete as written: a SHOULD NOT with no stated handling for the non-preferred case leaves a receiver without guidance, which is how this issue started.
wes-johnson commentedon Nov 25, 2026
Decision: a metric's datatype MUST be included in a BIRTH only. Implemented in #662.
That is option 2 from the comment above, taken with the ecosystem cost known. The specification had said SHOULD NOT since the decision was first recorded, so this closes the gap between the two.
Three things changed:
tck-id-payloads-metric-datatype-not-reqis now a MUST NOT, and states why: the datatype is established by the NBIRTH or DBIRTH that defined the metric, and a change is published as an amended BIRTH."datatype": "Float"on its metric, in both thespPv4.0andspJv4.0forms. The chapter was contradicting its own rule; both are corrected.setShouldResult, which records a MAYBE rather than a failure. It now scores it as a MUST.@elcombs — this is the answer to your question, two years on: MUST NOT. Your observation stands and was weighed: the Tahu reference implementations and production implementations do send a datatype in DATA, and they become non-conforming on this point. The reasoning for taking it anyway is that a datatype in DATA is redundant once BIRTH has established it, and a disagreeing datatype in DATA is an ambiguity the specification never resolved — removing the field removes the ambiguity rather than having to define it.
Still open
What a receiver does with a datatype that arrives anyway. A MUST NOT binds the publisher and says nothing about the consumer, and existing implementations will keep sending one for some time. A receiver that ignores it migrates gracefully; a receiver that rejects the message breaks every current implementation at once.
My expectation is "ignore it, and use the datatype from the BIRTH", but that is a second normative statement and a new assertion id, so it is left for the working group rather than folded into #662.
Leaving this issue open until that is settled. #446 continues as the general version of the question, with this as its first worked row.
[eclipse-sparkplug#449] Say what a receiver does with a datatype in D…
wes-johnson commentedon Nov 30, 2026
Receiver side decided and implemented in #662 (8787ba6): ignore a matching datatype, reject the message if it differs.
payloads-metric-datatype-data-ignored— a consuming application MUST ignore a datatype carried in NDATA, DDATA, NCMD or DCMD where it equals the datatype established for that metric by the BIRTH that defined it.payloads-metric-datatype-data-mismatch— where it differs, the application MUST reject the message and MUST NOT apply any metric value from it.Both govern a non-conforming publisher, since a conforming one never sends a datatype in these messages at all.
Correcting the record on compatibility. My earlier comment weighed the cost to the Tahu reference implementations and production implementations that send a datatype in DATA. That was misplaced: Sparkplug 4 is unreleased and those are Sparkplug 3 implementations on
spBv1.0, which this rule does not govern. There is no migration cost to weigh.One thing still not covered
The rules say the message is rejected; they do not say what the Host does next. After a mismatch its BIRTH-established datatype is known to disagree with what the Edge Node is sending, and discarding the message alone leaves the two out of step indefinitely.
The specification's established answer to an inconsistency a Host cannot resolve is a Rebirth Request — that is what it does for an unresolved sequence gap. Pairing the rejection with one looks like the coherent completion, but it is a third normative statement and another assertion id, so it is not in #662.
That is the last open point on this issue.
[eclipse-sparkplug#449] Request a Rebirth after rejecting a datatype …
wes-johnson commentedon Nov 30, 2026
Settled: a consuming application MUST send a Rebirth Request after rejecting a message for a datatype mismatch. Implemented in #662 (84d3b2f) as
payloads-metric-datatype-data-mismatch-rebirth.Rejecting alone left the two sides out of step — the consuming application's datatype for that metric is known to disagree with what the Edge Node is sending, and discarding the message does nothing about that. A Rebirth is the specification's existing answer to an inconsistency a Host cannot resolve, as it already is for an unresolved sequence gap, and it is the only mechanism for re-establishing a metric definition.
That closes the last open point. The rule is now complete on both sides:
datatypeMUST be in BIRTH, MUST NOT be in NDATA, DDATA, NCMD or DCMD#662 carries all of it, and this issue can close when that merges. #446 continues as the general mandatory/optional matrix, with this as its first worked row.
[eclipse-sparkplug#449] A Metric's datatype belongs in META, not alon…
[eclipse-sparkplug#449] A Metric's datatype belongs in META, not alon…
[eclipse-sparkplug#449] A Metric's datatype belongs in META, not alon…
wes-johnson commentedon Dec 1, 2026
Split after a review pass found that the wider change could not be made coherently in one go. #662 is closed; its reasoning is recorded there.
[#449] A metric's datatype MUST NOT accompany a value in DATA #664 — the part of this issue that stands on its own:
payloads-metric-datatype-not-reqbecomes a MUST NOT over NDATA and DDATA. NCMD and DCMD are excluded, because a Command invocation is identified by a metric datatype ofCommand. Three TCK corrections go with it: the check was scored throughsetShouldResult(a MAYBE, not a failure), the topic filter did not match the assertion, and the log text quoted the old wording.The datatype rules contradict each other across chapters, and the TCK enforces the wrong side #665 — everything that turned out to be a different problem:
payloads-metric-datatype-reqstill requires the datatype in NBIRTH and DBIRTH, directly contradictingtopics-nbirth-no-metadataandtopics-dbirth-no-metadata;SessionEstablishmentTestenforces that side, so a conforming Edge Node fails the TCK today, independently of anything here; Chapter 1 still states the pre-separation rule; and the same rules are duplicated across the Topics and Payloads chapters. It is the worked case of Clarify which components of a Sparkplug metric are mandatory and which are optional #446.The receiver rules — ignore a matching datatype, reject and rebirth on a differing one — are not carried forward yet. Two things have to be settled first:
payloads-json-typedvalue-flatdefines the singledatatypekey to be the TypedValue's, so a JSON Host Application can never observe a Metric datatype field and the rules can never fire. Nothing currently requires a reported value's datatype to agree with the definition, so the disagreement the rules exist to catch is ungoverned in that encoding.This issue stays open for those.
[eclipse-sparkplug#449] A metric's datatype MUST NOT accompany a valu…
[eclipse-sparkplug#449] A metric's datatype MUST NOT accompany a valu…
Merge pull request #664 from wes-johnson/449-pr-a
wes-johnson commentedon Dec 2, 2026
#664 is merged as 32abf59. The narrow part of this issue is done:
payloads-metric-datatype-not-reqis a MUST NOT over NDATA and DDATA in the Protocol Buffers encoding, replacing the SHOULD NOT that had been out of step with the recorded decision since it was taken.Command.payloads-json-typedvalue-carries-bothsets the TypedValue field only where the Metric datatype field is not permitted, so converting a conforming JSON payload no longer produces a non-conforming Protocol Buffers one.setResultIfNotFailrather thansetShouldResult, the topic filter matched to the assertion, and the dead call fromcheckCommandTopicPayloadremoved.Still open here: the receiver rules — ignore a datatype that matches the definition, reject and request a Rebirth where it differs. Two things have to be settled before they can land:
payloads-json-typedvalue-flatmakes the singledatatypekey the TypedValue's, so a JSON Host Application never observes a Metric datatype field and the rules cannot fire there. Nothing currently requires a reported value's datatype to agree with the definition, so the disagreement the rules exist to catch is ungoverned in that encoding.Separately, #665 carries the contradiction this issue kept running into:
payloads-metric-datatype-reqstill requires the datatype in NBIRTH and DBIRTH against the Topics chapter's prohibition,SessionEstablishmentTestenforces that side so a conforming Edge Node fails the TCK today, Chapter 1 still states the pre-separation rule, and the same rules are duplicated across chapters. None of it is caused by this issue and none is fixed by #664.