All updatesSeptember 7, 2026

Write detections in code

Regex and thresholds are great for common patterns. But sometimes the thing you care about is more specific.

Write detections in code

How it works

You can now write custom function detections in neatlogs. Pick a target, write a function, and return a boolean. Your code runs against a snapshot of every span or trace in scope, and anything that returns true gets flagged.

Use it for checks that need your own logic, like marking traces where cost, latency, metadata, and span content combine in a way simple rules can’t express. You can also train a classifier on your own labeled spans and run it across your traces as a detection, giving you another way to catch patterns that are easier to recognize than hard-code.

  • EnhancementCost analytics by metadata: Group trace cost by any metadata key, so you can see spend by customer, feature, model, or any other tag you send.
  • EnhancementBroader PII redaction: Server-side redaction now covers every supported span kind.
  • FixedMore reliable trends and evals: Detection trends and evals now handle large repeated query arrays more gracefully.
Write detections in code - neatlogs