MCPcopy Create free account
hub / github.com/SethGammon/Citadel / mapAgentRun

Function mapAgentRun

scripts/telemetry-otlp-export.js:176–193  ·  view source on GitHub ↗
(record, metrics)

Source from the content-addressed store, hash-verified

174// agent-runs.jsonl (schema 1): timestamp, event (agent-start, agent-complete,
175// agent-fail, campaign-*, wave-*, agent-timeout), agent, status, campaign_slug.
176function mapAgentRun(record, metrics) {
177 const nano = toUnixNano(record.timestamp);
178 if (!nano) return null;
179 if (typeof record.event !== 'string' || !record.event) return 0;
180
181 metrics['citadel.agent.runs'].dataPoints.push({
182 startTimeUnixNano: nano,
183 timeUnixNano: nano,
184 asInt: '1',
185 attributes: toAttributes({
186 'agent.name': record.agent || 'unknown',
187 'run.event': record.event,
188 'run.status': record.status || 'unknown',
189 'campaign.slug': record.campaign_slug,
190 }),
191 });
192 return 1;
193}
194
195// Reads bytes appended since storedOffset. Returns only complete lines; an
196// unterminated tail is included only when it already parses as JSON, otherwise

Callers

nothing calls this directly

Calls 2

toUnixNanoFunction · 0.85
toAttributesFunction · 0.85

Tested by

no test coverage detected