.agents/skills/query-agent-events/recipes/find-by-function.md
Use case: "Is anyone hitting a crash in function_name /
source/file.c?"
.agents/skills/query-agent-events/scripts/get-events.sh \
--function 'rrdcontext_release,rrdcontext_dispatch_updates_to_main' \
--since '7d ago' \
--versions auto \
--last 200 \
--output /tmp/by-function.json
--function is a comma-separated list -- multiple values are
OR'd via selections.AE_FATAL_FUNCTION. The query is fully
indexed (no FTS), so 7d windows are cheap.
Then:
.agents/skills/query-agent-events/scripts/analyze-events.sh \
--input /tmp/by-function.json \
--by version
# ...and...
.agents/skills/query-agent-events/scripts/analyze-events.sh \
--input /tmp/by-function.json \
--by signal
If you know the file but not the exact function:
# AE_FATAL_FILENAME is a `selections` field too.
# get-events.sh doesn't have a --filename flag; use jq to
# filter, OR construct the payload manually:
payload=$(jq -nc '{
"after": -604800,
"before": 0,
"last": 500,
"__logs_sources": "agent-events",
"selections": {
"AE_FATAL_FILENAME": ["src/database/rrdcontext/rrdcontext-cleanup.c"]
}
}')
agentevents_query_function cloud "$payload" > /tmp/by-filename.json
When the symbol may be in the stack trace but not directly
matched by AE_FATAL_FUNCTION (i.e. an inlined or downstream
callee):
.agents/skills/query-agent-events/scripts/get-events.sh \
--health crash \
--query 'inlined_callee_name' \
--since '7d ago' \
--versions auto \
--output /tmp/by-symbol.json
--health crash is the structured slice (index-friendly);
--query is the FTS narrower over the resulting subset. This
is the right composition.
AE_FATAL_STACK_TRACE,
AE_FATAL_LINE, AE_FATAL_MESSAGE, AE_FATAL_THREAD.fatal_function values that all crash in
the same source file -> the file has a structural issue
(state corruption, race condition, invariant violation).fatal_function value but mixed signals (SIGSEGV +
SIGBUS + SIGABRT) -> the function is a chokepoint hit by
many upstream paths.AE_AGENT_PROFILE_0=parent) -> the function is in the
streaming-receiver path.AE_FATAL_FUNCTION is the function where fatal() was
called, not necessarily the function where the crash
occurred. For signal crashes, it's the function name
recorded by the deadly-signal handler.MyClass::method). Try the demangled
form in --function.