- A
datadogdrain in statehealthy. Confirm withlua drains status. - A Datadog API key and an application key, if you import over the API.
- Three log facets created once, from any record:
@lua.eventName,@lua.attributes.lua.source, and@lua.attributes.gen_ai.tool.name. Open one Lua record in Log Explorer, expandlua, and choose Create facet on each. Grouping and alerting need them; plain search does not.
What you get
Install the heartbeat monitor first. It is the one that makes the other three trustworthy: they all alert on the presence of something, so their silence is only meaningful while the pipeline is known to be up.
Import it
- Datadog UI
- API
One monitor at a time: Monitors → New Monitor → Import Monitor from JSON, paste a single object from the
monitors array, then Save. Repeat for the other three.Add your notification handles to each monitor’s message before saving — the pack ships with none, so an imported monitor alerts in the UI and pages nobody.The pack
lua-datadog-monitors.json
Tune it
- Notification handles. Append
@slack-your-channel,@pagerduty-your-service, or@[email protected]to eachmessage. Nothing in the pack notifies anyone as shipped. - Thresholds. “More than 5 errors in 5 minutes” is a starting point, not a measurement of your traffic. Run the query in Log Explorer over the last week and set the threshold above your normal peak.
- Grouping. The error and truncation monitors group
by("service,env"), whereserviceis the agent’s name andenvcomes from the drain’senv:tag — so production and sandbox alert separately, per agent. Group byagentinstead to key on the agent id. - Selecting errors.
@lua.eventName:lua.*.errormatches every source’s error records.@lua.severityText:ERRORselects exactly the same set and needs no wildcard, if you would rather not rely on one. - Multi-alert noise.
new_group_delay: 60stops a newly created agent alerting on its first minute. Raise it if you create agents in bursts. - The heartbeat monitor alerts twice on purpose. It carries both a
< 1threshold andnotify_no_data, so it fires whether your index reports a zero count or reports nothing at all. For the one alert every other alert depends on, a duplicate page is better than a missed one. Dropnotify_no_dataonce you have seen it fire correctly in your own organization.
Why these queries
The Datadog encoder puts the whole record under alua key, so every schema field is addressable as an attribute: @lua.eventName, @lua.severityText, @lua.attributes.<name>. That makes eventName the natural selector here.
The Grafana pack selects differently — on attributes such as lua_drain_backlog rather than on the event name — because Loki’s OTLP ingestion indexes attributes rather than the OTLP eventName field. The two packs watch the same four signals; only the way they address them differs.
Next steps
Datadog
Create the drain these monitors watch.
Delivery guarantees
What the heartbeat and the drop record mean.
Event schema
Every field these queries address.
Grafana dashboard
The same signals, over Loki.

