MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / printRecentTraces

Function printRecentTraces

scripts/ft-file-selection/print-recent-traces.ts:7–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5const DATASET = isProd ? 'codebuff_data' : 'codebuff_data_dev'
6
7async function printRecentTraces() {
8 try {
9 // Setup BigQuery client
10 setupBigQuery({ logger: console })
11 .catch((err) => {
12 console.error(
13 {
14 error: err,
15 stack: err.stack,
16 message: err.message,
17 name: err.name,
18 code: err.code,
19 details: err.details,
20 },
21 'Failed to initialize BigQuery client',
22 )
23 })
24 .finally(() => {
25 console.debug('BigQuery initialization completed')
26 })
27
28 // Use the BigQuery client to get recent traces
29 const traces = await getRecentTraces(10, DATASET)
30
31 console.log('\nLast 10 traces by timestamp:')
32 console.log('--------------------------------')
33 console.log(`Using dataset: ${DATASET}`)
34 console.log('--------------------------------')
35
36 traces.forEach((trace) => {
37 console.log(`
38ID: ${trace.id}
39User ID: ${trace.user_id}
40Agent Step ID: ${trace.agent_step_id}
41Type: ${trace.type}
42Created at: ${JSON.stringify(trace.created_at)}
43Payload: ${JSON.stringify(trace.payload, null, 2).slice(0, 100)}...
44--------------------------------`)
45 })
46 } catch (error) {
47 console.error('Error fetching traces:', error)
48 }
49}
50
51// Run the function
52printRecentTraces()

Callers 1

Calls 2

setupBigQueryFunction · 0.90
getRecentTracesFunction · 0.90

Tested by

no test coverage detected