Non puoi fare debug di ciò che non hai loggato. Polylane trova i tuoi punti ciechi e li chiude.
Iscriviti alla lista d'attesa Observability improvements for #218 polylane +22 −2
Requests do not produce one context-rich event
3 affected routes · found after the last sync
server/api/checkout.post.ts mirrors your existing OpenTelemetry setup; no new dependencies
export default defineEventHandler(async (event) => {
const body = await readBody(event);
- const order = await createOrder(body);
- return { orderId: order.id };
+ return tracer.startActiveSpan("checkout", async (span) => {
+ const canonical: Record<string, unknown> = {
+ route: "checkout",
+ requestId: event.context.requestId,
+ cartId: body.cartId,
+ traceId: span.spanContext().traceId,
+ };
+ try {
+ const order = await createOrder(body);
+ span.setAttributes({ "order.id": order.id, "order.amount_cents": order.amountCents });
+ Object.assign(canonical, { orderId: order.id, amountCents: order.amountCents, outcome: "ok" });
+ return { orderId: order.id };
+ } catch (err) {
+ span.recordException(err);
+ span.setStatus({ code: SpanStatusCode.ERROR });
+ canonical.outcome = "error";
+ throw err;
+ } finally {
+ span.end();
+ emitCanonicalLogLine(canonical);
+ }
+ });
});
Opened against the pull request's own branch, so it can merge before the branch does.
Scopri la riga di log mancante nel bel mezzo di un incidente. Polylane la trova prima.
-
Legge le tue route
Quali loggano, quali tracciano, quali inghiottono gli errori. Le lacune diventano risultati, ciascuno con prove e un fix.
-
Il tuo stack, non uno nuovo
Il tuo logger, la tua configurazione OpenTelemetry, le tue convenzioni. Nessuna nuova dipendenza, mai un segreto nei log.
-
Fix come pull request
La prima arriva quando ti colleghi. Le successive viaggiano insieme alle code review, sul tuo branch.
-
Sa quando fermarsi
Già solido? Lo dice e si ferma.