(entry: OutboundRequestEntry)
| 24 | * so monitoring never blocks the request path. |
| 25 | */ |
| 26 | export function logOutboundRequest(entry: OutboundRequestEntry): void { |
| 27 | query( |
| 28 | `INSERT INTO agent_outbound_requests |
| 29 | (agent_url, request_type, user_agent, response_time_ms, success, error_message) |
| 30 | VALUES ($1, $2, $3, $4, $5, $6)`, |
| 31 | [ |
| 32 | entry.agent_url, |
| 33 | entry.request_type, |
| 34 | entry.user_agent, |
| 35 | entry.response_time_ms ?? null, |
| 36 | entry.success, |
| 37 | entry.error_message ?? null, |
| 38 | ], |
| 39 | ).catch(err => { |
| 40 | logger.warn({ err, agentUrl: entry.agent_url }, 'Failed to log outbound request'); |
| 41 | }); |
| 42 | } |
| 43 | |
| 44 | export async function getRequestLog( |
| 45 | agentUrl: string, |
no test coverage detected