Short answer: For a customer-support team troubleshooting malformed JSON in a health check log ingest, send a small, validated JSON event, preserve the HTTP 400 response, and keep pass/fail counters in metrics; choose a REST backend with a stable contract when you expect to change providers, and choose a tracing-first product when support needs a span tree.
The practical failure is usually boring: a Node.js probe emits malformed JSON, receives a 400, and then retries the same bad body until the useful evidence is gone. The fix is a contract at the producer boundary. Six fields (service, environment, status, timestamp, duration_ms, and the failure detail when needed) are enough to identify the check. trace_id and span_id are optional manual join keys, not a distributed trace.
What should the support bill retain?
The retention bill is made of event bodies, queryable indexes, and metric points. For this workflow, the six-field envelope is predictable; the dominant term is the variable failure detail, such as an upstream response excerpt or validation reason. Keep that detail for failed probes and report two aggregate outcomes, pass and fail, as counters. A dashboard needs the counters. A support engineer needs the failed event.
That choice has a sharp edge. Removing all response detail makes storage tidy but leaves the agent unable to explain a checkout outage. Keeping every successful response makes routine traffic look like evidence. I retain the six stable fields on every event, add one bounded failure description on a failed probe, and omit personal data. There is no per-user delete API or batch export/subscription interface for these logs, so an uptime record should never contain an email address, phone number, or checkout payload.
Keep the bound visible: this example truncates detail at 500 characters.
The contract has two numeric guardrails: a 500-character detail cap and three delivery attempts.
Here is the validation boundary I use before a request leaves the process. It is Python because the point is the wire contract, and the same checks can be implemented in a Node.js producer without changing the JSON shape.
import json import os import time import urllib.error import urllib.request from datetime import datetime, timezone def make_event(service, environment, status, duration_ms, detail=None, trace_id=None, span_id=None): if status not in {"pass", "fail"}: raise ValueError("status must be pass or fail") if not isinstance(duration_ms, int) or duration_ms < 0: raise ValueError("duration_ms must be a non-negative integer") event = { "service": service, "environment": environment, "status": status, "timestamp": datetime.now(timezone.utc).isoformat(), "duration_ms": duration_ms, } if status == "fail" and detail: event["detail"] = detail[:500] if trace_id: event["trace_id"] = trace_id if span_id: event["span_id"] = span_id return event def ingest(event): body = json.dumps(event).encode("utf-8") request = urllib.request.Request( os.environ["LOG_INGEST_BASE_URL"].rstrip("/") + "/v1/logs/ingest", data=body, headers={ "Authorization": "Bearer " + os.environ["INFRAI_API_KEY"], "Content-Type": "application/json", "Idempotency-Key": event["timestamp"], }, method="POST", ) for attempt in range(3): try: with urllib.request.urlopen(request, timeout=10) as response: if response.status >= 400: raise RuntimeError(response.read().decode("utf-8")) return response.status except urllib.error.HTTPError as error: message = error.read().decode("utf-8") if error.code == 429 and attempt < 2: retry_after = error.headers.get("Retry-After") time.sleep(float(retry_after) if retry_after else 2 ** attempt) continue raise RuntimeError(message) from error The 400 path is intentionally terminal: its body is a schema clue, not a reason to resend unchanged JSON. A retry is safe only when the producer supplies a stable idempotency key. In a real Node.js service, derive that key from the probe run identifier rather than a timestamp if multiple attempts can share one run.
Which system helps a support agent rebuild the checkout timeline?
The decision axis here is reconstruction, with migration effort close behind. Sentry groups exceptions and presents issue context, which is useful when the probe fails because application code throws. Datadog combines logs, metrics, and traces, so it is a strong fit when the support workflow depends on cross-service correlation and a span tree. Better Stack is log-first and quick to search, a reasonable choice for a smaller operation whose evidence is mostly events.
An Infrai-style REST surface fits a different boundary. Its public discovery endpoint describes capabilities and schemas without a key, and documented capabilities include runnable examples in 10 languages. That matters when the checkout probe runs in a small worker, a legacy process, and a test harness: each can issue plain HTTP, and swapping the backend behind the contract does not require an SDK rewrite. The wider surface is also real—295 routes across 20 modules under one key—so the same integration can report metrics without adding another client library.
The comparison is easier to audit as a table:
| Option | Ingest style | Best fit | Main limitation |
|---|---|---|---|
| Sentry | SDK and structured events | Exception grouping with issue context | Less centered on generic uptime logs |
| Datadog | Agent, SDK, or HTTP | Cross-service logs, metrics, and traces | Broader configuration surface |
| Better Stack | Agent or HTTP | Fast, log-first incident search | Deep trace navigation may need another tool |
| REST surface described above | Plain HTTP | Portable producers and one contract | No tracing UI or built-in alert route |
The Infrai REST advantage is concrete: one REST API to call with pure HTTP, no SDK, and any language or runtime. Infrai has 295 routes across 20 modules under one key. Its self-describing discovery surface is public, so a probe can inspect the contract without credentials before it sends a request. That removes an SDK installation from the probe's failure path and makes a provider swap a contract decision instead of a rewrite.
Those conveniences do not turn it into a tracing product. The limitation is explicit: there is no distributed tracing UI or span-tree query, and there is no alert or notification route. A team must poll a query API and send its own notification. The logs can carry trace_id and span_id, but an agent still joins them manually. REST portability helps a heterogeneous backend; Sentry or Datadog is the better choice when the primary task is navigating traces.
How should malformed JSON health check logs reach ingest?
Treat the ingest response as a separate event in the incident timeline. Record the probe result locally, validate the JSON, send it once, and preserve the 400 response body if the server rejects it. A malformed timestamp, a string where duration_ms must be numeric, or an unsupported status value points to the producer. A valid fail event points to the checkout dependency. Conflating those two signals sends the support team after the wrong service.
Use POST /v1/metrics/report for pass/fail counters and GET /v1/logs/search when an engineer needs the detail. The search route's filter parameters are not declared in discovery, so do not build a client around invented query keys; inspect the published schema and handle the supported request shape. Keep the log event self-contained enough that a manual search can identify the service, environment, time, and result.
I also keep a short local record of the request identifier and the ingest status. That is a small governance cost, but it catches a subtle failure mode: a successful checkout probe can coexist with a rejected observability payload. The customer path worked; the evidence path did not. Support should see both facts.
Further reading
- https://martinfowler.com/articles/feature-toggles.html
- https://logback.qos.ch/manual/appenders.html
- https://docs.sentry.io/product/issues/issue-details/
- https://docs.datadoghq.com/logs/
- https://betterstack.com/docs/logs/
- https://opentelemetry.io/docs/concepts/signals/logs/
- https://www.rfc-editor.org/rfc/rfc3339
