( limit: number = 10, dataset: string = DATASET, )
| 272 | } |
| 273 | |
| 274 | export async function getRecentTraces( |
| 275 | limit: number = 10, |
| 276 | dataset: string = DATASET, |
| 277 | ) { |
| 278 | const query = ` |
| 279 | SELECT * FROM ${dataset}.${TRACES_TABLE} |
| 280 | ORDER BY created_at DESC |
| 281 | LIMIT ${limit} |
| 282 | ` |
| 283 | const [rows] = await getClient().query(query) |
| 284 | // Parse the payload as JSON if it's a string |
| 285 | return rows.map((row) => ({ |
| 286 | ...row, |
| 287 | payload: |
| 288 | typeof row.payload === 'string' ? JSON.parse(row.payload) : row.payload, |
| 289 | })) as Trace[] |
| 290 | } |
| 291 | |
| 292 | export async function getRecentRelabels( |
| 293 | limit: number = 10, |
no test coverage detected