Troubleshooting: Usage Billing - Data Enrichment
The DIP enricher reads raw events from the RAW_EVENTS_<n> NATS streams, enriches them, and publishes the results to the ENRICHED_EVENTS_<n> streams. Exporters read from those. This page covers raw messages the enricher gave up on.
Enricher terminated raw messages
Section titled “Enricher terminated raw messages”The enricher retries a raw message that fails, with increasing delays (1s, 5s, 30s, then 60s), and stops after 15 deliveries, about 12 minutes of retries. It stops immediately when the failure can never succeed. A stopped message is terminated: NATS does not deliver it again, and its events are not enriched or exported until someone replays it.
Each terminated message increments enricher_messages_terminated_total, labeled with a reason:
reason | Meaning | Replay once the cause is fixed? |
|---|---|---|
max_deliveries | A failure that could have been temporary (NATS unavailable, publish timeouts) lasted for all 15 deliveries. | Yes. The events are probably valid. |
permanent_error | A failure that repeats on every delivery: the enricher panicked on the payload, or a result was larger than the NATS message size limit. | No. Replaying fails the same way. Keep the payload for the DIP team. |
Terminated messages stay in the raw stream until the stream’s retention expires. Replay or save them before then.
1. Check the scope
Section titled “1. Check the scope”- Query
enricher_messages_terminated_totalbyreasonin Grafana Explore (it isn’t on a dashboard yet). Are many messages being terminated, or a few?- Many
max_deliveriesat once usually means NATS was unavailable for more than ~12 minutes. Check NATS health first: NATS - Usage Billing Dashboard, NATS - Runbooks. - A few
permanent_errorusually means malformed input from a client.
- Many
- On the Data Insights Platform - Usage Billing Dashboard, check the Enrichment panels for a drop in enriched events.
2. Find the terminated messages
Section titled “2. Find the terminated messages”In Kibana, search the enricher’s logs for:
"handling message, terminating"Each entry carries:
streamandstream_seq: where the raw message is in NATS.num_delivered: how many times it was delivered.reason:max_deliveriesorpermanent_error.error: the last failure.
Earlier attempts for the same message are logged as handling message, will retry with the same stream_seq.
3. Fetch the raw message
Section titled “3. Fetch the raw message”Use the nats CLI in the nats-box deployment (see NATS Operations), after connecting to the cluster as described in GKE setup:
➜ ~ kubectl -n nats exec -it deploy/nats-box -- sh~ # nats stream get RAW_EVENTS_0 123456The output shows the message’s subject, headers, and payload. Raw events are Thrift-encoded, so the payload is mostly binary. To share or replay the message, save it to your workstation instead of the pod, where it would be lost on restart:
➜ ~ kubectl -n nats exec deploy/nats-box -- nats stream get RAW_EVENTS_0 123456 --json > raw-123456.json➜ ~ jq -r .subject raw-123456.jsonThe file holds the message’s subject and its payload in data, base64-encoded. Payloads can contain customer data, so share them only in a confidential issue.
4. Replay or hand over
Section titled “4. Replay or hand over”-
For
max_deliveries, once the cause (usually NATS) is fixed, publish the payload again to its original subject. The enricher processes it as a new message:➜ ~ jq -r .data raw-123456.json | base64 -d \| kubectl -n nats exec -i deploy/nats-box -- nats pub "$(jq -r .subject raw-123456.json)" --force-stdin --no-templates--no-templatesis required: by default,nats pubtreats{{in the payload as a template and changes the bytes it publishes. The raw message had no NATS headers, so the replay is identical to the original.Replay each terminated message once. If some of its events were published before it was terminated, replaying publishes them again. DIP promises at-least-once delivery and leaves deduplication to destination systems (see Message queueing).
-
For
permanent_error, don’t replay. Open a confidential issue for the DIP team (~“group::platform insights”) with thestream,stream_seq,error, and the savedraw-<stream_seq>.json, before the stream’s retention removes the message.