1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-14 03:23:17 -05:00
denoland-deno/tests/specs/cli/otel_basic/basic.ts
snek 4e899d48cf
fix: otel resiliency (#26857)
Improving the breadth of collected data, and ensuring that the collected
data is more likely to be successfully reported.

- Use `log` crate in more places
- Hook up `log` crate to otel
- Switch to process-wide otel processors
- Handle places that use `process::exit`

Also adds a more robust testing framework, with a deterministic tracing
setting.

Refs: https://github.com/denoland/deno/issues/26852
2024-11-14 12:16:28 +00:00

24 lines
553 B
TypeScript

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
async function inner() {
using _span = new Deno.tracing.Span("inner span");
console.log("log 1");
await 1;
console.log("log 2");
}
const server = Deno.serve({
port: 0,
async onListen({ port }) {
try {
await fetch(`http://localhost:${port}`);
} finally {
server.shutdown();
}
},
handler: async (_req) => {
using _span = new Deno.tracing.Span("outer span");
await inner();
return new Response(null, { status: 200 });
},
});