Troubleshooting
Why an MQTT collector logs DBIRTH but ignores DDATA
Short answer
DBIRTH arriving in the historian proves the broker path, the subscription filter and birth decoding all work, so the fault is confined to DDATA processing. Match the published DDATA topic, metric names and Float types to the birth, verify the payload sequence advances by exactly one, and read the collector diagnostic log for the named rejection. If a known-good publisher updates the tags, replace the modified script.
On this page
A Sparkplug collector that builds tags from NBIRTH and DBIRTH, stores the declared birth values, and then never updates them again has already told you most of what you need: the broker transport, the subscription filter and the birth decoder all work. The fault sits on the DDATA processing path, and it can only be in a few places. Compare the topic the loop actually publishes against the filter, hold the metric names and Float types identical to the birth, confirm the payload sequence advances by exactly one, and read the collector's diagnostic log for the rejection it records. In the incident this article follows, broker delivery was independently observed and the sequence was reported changing, which points hardest at the modified client's payload helper or its session state; the isolation test at the end settles it.
What the DBIRTH evidence already proves #
The observations come from one deployment: collector version 23.2.1, a broker on the same host, and a client built from a modified reference Python Sparkplug example. Sort the evidence before touching anything:
- An independent subscriber utility running against the broker sees every DDATA message arrive, so the client connects and the broker delivers.
- NBIRTH and DBIRTH are processed and the historian holds the four tags with their declared values, so the subscription, the Protobuf decode and birth handling all work.
- The tags never move off those values, so the specific failure is DDATA acceptance, not data quality.
- Both sides run at QoS 0 with retain off, which promises no acknowledgment, but delivery is observed, so QoS is not the cause here.
A message seen at the broker proves transport and nothing more; MQTT broker support is not Sparkplug support, and interpretation still has to happen inside the collector. The acknowledgment gap in QoS 0 matters in deployments where delivery is unconfirmed, which is the failure mode behind covering the QoS 0 loss window in Sparkplug transmission. If you ever do need delivery assurance on a lossy path, buffered offline message delivery versus standard QoS levels is the tradeoff to settle. Neither is this fault.
Match the published topic against the filter #
Sparkplug fixes the namespace: every message travels on spBv1.0/<group>/<message_type>/<node>/<device>. The collector subscribes with spBv1.0/GroupID/+/NodeID/#, and the client builds its DDATA topic from myGroupId, myNodeName and myDeviceName. Laid side by side, writing the runtime strings as the values the filter literals require:
filter spBv1.0 / GroupID / + / NodeID / #
DBIRTH spBv1.0 / GroupID / DBIRTH / NodeID / device
DDATA spBv1.0 / GroupID / DDATA / NodeID / device
The plus covers the message-type segment and the hash covers the device, so DBIRTH and DDATA share every segment except the type. DBIRTH already arrives through this filter, which means the runtime values behind myGroupId and myNodeName already satisfy the literals GroupID and NodeID, and the device segment sits under the hash. A topic miss is therefore possible only if the publishing loop uses different strings than the birth function did: a renamed variable, a trailing space, a different device name in the loop. One capture of a delivered DDATA with the topic visible settles the comparison in seconds. If the captured topic matches the birth's topic in every segment except the type, the filter is excluded; stop suspecting it.
Hold the metric identity to the birth #
The birth is the contract: a device birth must declare every metric the device will ever report, each with a name, a datatype and a current value. This DBIRTH declares four Float metrics, ABCD at 25.1, EFGH at 3.1, IJKL at 4.81 and MNOP at 4.81, and every DDATA repeats the same four names through the same addMetric call with MetricDataType.Float and the alias argument left as None. Names and types therefore match by construction, and a mismatch could only be a rename or a type change introduced inside the loop. Verify it on the wire anyway by decoding one captured DDATA, because a one-character slip in a metric name is invisible in a scrolling log and is grounds for a collector to drop a metric it never saw declared.
Aliases are a separate mechanism: numeric references declared in the birth so later messages can omit names. Their absence is not this fault, since this client sends full names in both message types. The alias mechanics behind why a Rebirth metric can arrive without its Sparkplug alias belong to a different failure; do not chase them here.
Verify the sequence chain #
Sparkplug numbers an edge node's messages consecutively: the payload's seq starts at 0 in the node birth, steps up by one on every message the node publishes, and wraps from 255 back to 0. The number exists so the consuming side can detect a missed message, and a gap or a repeat is grounds to discard the data or force a fresh birth.
In this client, getDdataPayload() owns the timestamp and the sequence, and the manual assignment payload.seq = get_next_seq() sits commented out in the loop. The report says both fields are changing, but changing is not the same as advancing by exactly one: a chain that reads 2, 5, 11 is changing and still broken.
Worked example, one node and one device. The births consume seq 0 for the NBIRTH and 1 for the DBIRTH, so every DDATA must carry the previous value plus one:
- First DDATA: 1 + 1 = 2
- Second DDATA: 2 + 1 = 3
- 254th DDATA: 255, the field's maximum
- 255th DDATA: 255 + 1 = 256, which wraps to 0
Decode the captured DBIRTH and the very next DDATA and run that arithmetic on the actual fields. If the helper stalls, jumps or repeats, the chain is the fault. Enable the commented manual assignment only after proving the helper leaves the field alone, because two writers on one seq field is its own defect: the count would advance twice per message.
Read the collector diagnostic log #
Turn on the collector's diagnostic logging, a switch that lives with the collector's configuration in the historian's tooling, publish one DDATA with known values, and read the entry stamped at that moment. The log names the rejection: an undeclared metric, a datatype conflict, a sequence complaint, a session-state error. That name ends the search, because each branch above has a matching signature. A log that shows nothing at all for a message you watched arrive means the collector never saw it on its subscription, and you go back to the topic capture.
Isolate the publisher from the collector #
Two known-good paths, both through the same broker and the same collector:
- Loop a known DataSet: publish an existing DataSet, or one sub-branch of it, through the historian's publisher service, and collect it back into a separate DataSet.
- Simulated traffic: run the vendor's data-generation tool against the same broker with a Sparkplug B payload.
Keep both tests in a separate DataSet so simulated values can never land in the production history. Then decide:
- Either path produces historian updates from data messages, and the broker and collector are proven; the fault is in the modified client, in its payload helper or its session state. Fix the script or retire it in favor of the supported publisher.
- Neither path updates, and you leave the script alone; the fault is on the collector side, and the diagnostic log plus the vendor's support channel is the route.
Prove recovery #
The failure signature is exact: the four tags sit at their birth seeds of 25.1, 3.1, 4.81 and 4.81 while the loop publishes rounded random values drawn from 20.0 to 30.0 for ABCD, 2.0 to 4.0 for EFGH, and 5.0 to 10.0 for IJKL and MNOP. As an illustrative capture, suppose one DDATA decodes to ABCD 27.43, EFGH 3.22, IJKL 7.91 and MNOP 6.05, every value inside its range. Recovery is proven when the historian shows 27.43 on ABCD after that message; any tag still equal to its birth seed means the DDATA path is still dead. All four metrics ride one payload, so they live or die together: one tag moving while three stay flat points at per-tag configuration on the collector, not at the publisher.
Questions asked
Does the filter spBv1.0/GroupID/+/NodeID/# match a DDATA topic?
Yes, when the runtime strings line up. The plus sign matches exactly one topic segment, so it accepts DDATA in the message-type position, and the hash matches everything after it, including the device segment. A topic like spBv1.0/GroupID/DDATA/NodeID/Pump1 passes only if the published group and node strings are literally GroupID and NodeID; since DBIRTH already arrives through the same filter, any mismatch would have to be a string that changed inside the publishing loop.
Can QoS 0 explain why DDATA values never appear?
Not in this case. QoS 0 carries no delivery acknowledgment, so it is the first suspect when messages might be lost in transit, but an independent subscriber on the broker watches the DDATA messages arrive. Once delivery is observed, the loss window that QoS 0 opens is closed as a cause, and the remaining suspects all sit on the collector's interpretation path: topic, metric identity, sequence and session state.
Do the DDATA metrics need aliases to be logged?
No. An alias is a numeric reference a birth declares alongside each metric name so later messages can omit the name; sending full names in every DDATA is the fully self-describing form, and that is what this publisher does in both message types. Treat an alias requirement as collector-specific behavior you confirm in its documentation, and test it by declaring aliases in the birth and reusing them, not by guessing.
The tags exist with the DBIRTH values and never move. What does that tell you?
It confirms the split between the two paths. Birth processing creates the historian tags and seeds them with the declared values 25.1, 3.1, 4.81 and 4.81, so tag creation and value storage both work. Values flat at those seeds mean no DDATA has been accepted since. Recovery is proven the same way: after the next accepted DDATA, at least one tag must show a value outside its birth seed.