feat(logging): add usage logging hooks for AI stack monitoring
- Add usage-logging hook that sends events to log-ingest service - Track session start/end, tool calls, and token usage - Integrate with LOG_INGEST_URL environment variable - Update hooks index to include usage-logging
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
createStartWorkHook,
|
||||
createSisyphusOrchestratorHook,
|
||||
createPrometheusMdOnlyHook,
|
||||
createUsageLoggingHook,
|
||||
} from "./hooks";
|
||||
import {
|
||||
contextCollector,
|
||||
@@ -212,6 +213,13 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
? createPrometheusMdOnlyHook(ctx)
|
||||
: null;
|
||||
|
||||
const usageLogging = isHookEnabled("usage-logging")
|
||||
? createUsageLoggingHook({
|
||||
stackName: process.env.STACK_NAME,
|
||||
ingestUrl: process.env.LOG_INGEST_URL,
|
||||
})
|
||||
: null;
|
||||
|
||||
const taskResumeInfo = createTaskResumeInfoHook();
|
||||
|
||||
const backgroundManager = new BackgroundManager(ctx);
|
||||
@@ -411,6 +419,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
await interactiveBashSession?.event(input);
|
||||
await ralphLoop?.event(input);
|
||||
await sisyphusOrchestrator?.handler(input);
|
||||
await usageLogging?.event(input);
|
||||
|
||||
const { event } = input;
|
||||
const props = event.properties as Record<string, unknown> | undefined;
|
||||
|
||||
Reference in New Issue
Block a user