File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,17 @@ export class RuntimeManager {
324324 return response . data as TraceData ;
325325 }
326326
327+ /**
328+ * Adds a trace to the trace store
329+ */
330+ async addTrace ( input : TraceData ) : Promise < void > {
331+ await axios
332+ . post ( `${ this . telemetryServerUrl } /api/traces/` , input )
333+ . catch ( ( err ) =>
334+ this . httpErrorHandler ( err , 'Error writing trace to store.' )
335+ ) ;
336+ }
337+
327338 /**
328339 * Notifies the runtime of dependencies it may need (e.g. telemetry server URL).
329340 */
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323} from '../eval' ;
2424import type { RuntimeManager } from '../manager/manager' ;
2525import { GenkitToolsError , type RuntimeInfo } from '../manager/types' ;
26+ import { TraceDataSchema } from '../types' ;
2627import type { Action } from '../types/action' ;
2728import * as apis from '../types/apis' ;
2829import type { EnvironmentVariable } from '../types/env' ;
@@ -164,6 +165,14 @@ export const TOOLS_SERVER_ROUTER = (manager: RuntimeManager) =>
164165 return manager . getTrace ( input ) ;
165166 } ) ,
166167
168+ /** Adds a trace to the trace store */
169+ addTrace : loggedProcedure
170+ . input ( TraceDataSchema )
171+ . output ( z . void ( ) )
172+ . mutation ( async ( { input } ) => {
173+ return manager . addTrace ( input ) ;
174+ } ) ,
175+
167176 /** Retrieves all eval run keys */
168177 listEvalRunKeys : loggedProcedure
169178 . input ( apis . ListEvalKeysRequestSchema )
You can’t perform that action at this time.
0 commit comments