1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-03 17:08:35 -05:00
denoland-deno/tests/specs/cli/otel_basic/child.ts
snek aa546189be
feat: OpenTelemetry Tracing API and Exporting (#26710)
Initial import of OTEL code supporting tracing. Metrics soon to come.
Implements APIs for https://jsr.io/@deno/otel so that code using
OpenTelemetry.js just works tm.

There is still a lot of work to do with configuration and adding
built-in tracing to core APIs, which will come in followup PRs.

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-11-13 10:38:46 +00:00

20 lines
462 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");
}
Deno.serve({
port: 0,
onListen({ port }) {
console.log(port.toString());
},
handler: async (_req) => {
using _span = new Deno.tracing.Span("outer span");
await inner();
return new Response(null, { status: 200 });
},
});