diff options
Diffstat (limited to 'tests/specs/cli/otel_basic/basic.ts')
-rw-r--r-- | tests/specs/cli/otel_basic/basic.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/specs/cli/otel_basic/basic.ts b/tests/specs/cli/otel_basic/basic.ts new file mode 100644 index 000000000..5a178794a --- /dev/null +++ b/tests/specs/cli/otel_basic/basic.ts @@ -0,0 +1,24 @@ +// 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 }); + }, +}); |