Urgent.News

What's breaking now, across thousands of outlets.

Tech

Express Node.js Structured Logs — Poll Error Search for 30-Day Cost Attribution

Short answer: have the Express Node.js service send structured logs for every completed AI-agent step, then poll the log search for new error events and trigger deduplicated Slack notifications. Attach stable tenant, run, model, token, latency, and outcome fields. For a B2B SaaS agent, keep the small attribution fields longer than bulky request and response bodies. This is the least complex…

The article discusses a structured logging approach for an Express Node.js service that utilizes AI-agent step completion. The service should send structured logs for each completed step, which includes relevant information such as tenant ID, workflow ID, run ID, step ID, model identifier, token counts, latency, and outcome. The logs should be concise, focusing on the essential fields necessary for diagnosis and attribution.

Key points include:

1. Sentient the Express service to emit logs after each step completes, ensuring duration, outcome, and usage metrics are known.

2. Include relevant fields such as tenant ID, workflow ID, run ID, step ID, model identifier, input and output token counts, elapsed milliseconds, and outcome.

3. Add an error class and sanitized error message for failure events.

4. Retain only the necessary fields, excluding bulky request and response bodies to minimize storage costs.

5. Consider three logical classes of events: attribution events (longer retention for reconciliation and trend comparisons), diagnostic excerpts (shorter retention and stricter access), and alert-delivery records (fingerprint, attempt state, and destination response category).

6. Store sanitized failure details for debugging specific runs, but avoid storing full conversational content.

7. Measure latency for the entire agent run and individual steps separately, without adding step durations to the wall-clock latency.

8. Use stable names and explicit units for fields, following Prometheus naming guidance for consistency in log-to-metric transformations.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

What OMA returns when its test gate fails

oh-my-agent (OMA) can rerun a configured test script when an active workflow tries to stop. This example exercises that behavior with manual hook calls and a deliberately broken expiry check.

  • OMA returns decision block when test gate fails
  • Failure reason: stop gate test failed
  • Issue resolved by fixing code comparison

gVisor is being donated to CNCF

  • Google donates gVisor project to CNCF, Apache 2.0 licensed
  • gVisor provides security without virtualization checkbox
  • CNCF aims to enhance gVisor adoption beyond tech companies

More from Saturday 3 October →