( limit: number = 10, dataset: string = DATASET, )
| 290 | } |
| 291 | |
| 292 | export async function getRecentRelabels( |
| 293 | limit: number = 10, |
| 294 | dataset: string = DATASET, |
| 295 | ) { |
| 296 | const query = ` |
| 297 | SELECT * FROM ${dataset}.${RELABELS_TABLE} |
| 298 | ORDER BY created_at DESC |
| 299 | LIMIT ${limit} |
| 300 | ` |
| 301 | const [rows] = await getClient().query(query) |
| 302 | // Parse the payload as JSON if it's a string |
| 303 | return rows.map((row) => ({ |
| 304 | ...row, |
| 305 | payload: |
| 306 | typeof row.payload === 'string' ? JSON.parse(row.payload) : row.payload, |
| 307 | })) as Relabel[] |
| 308 | } |
| 309 | |
| 310 | export async function getTracesWithoutRelabels( |
| 311 | model: string, |
no test coverage detected