From aa546189be730163ee5370029e4dfdb3b454ab96 Mon Sep 17 00:00:00 2001 From: snek Date: Wed, 13 Nov 2024 11:38:46 +0100 Subject: 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 --- runtime/js/90_deno_ns.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'runtime/js/90_deno_ns.js') diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index fd2ac00f2..11f618ce2 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -29,6 +29,7 @@ import * as tty from "ext:runtime/40_tty.js"; import * as kv from "ext:deno_kv/01_db.ts"; import * as cron from "ext:deno_cron/01_cron.ts"; import * as webgpuSurface from "ext:deno_webgpu/02_surface.js"; +import * as telemetry from "ext:runtime/telemetry.js"; const denoNs = { Process: process.Process, @@ -134,7 +135,7 @@ const denoNs = { createHttpClient: httpClient.createHttpClient, }; -// NOTE(bartlomieju): keep IDs in sync with `cli/main.rs` +// NOTE(bartlomieju): keep IDs in sync with `runtime/lib.rs` const unstableIds = { broadcastChannel: 1, cron: 2, @@ -143,11 +144,12 @@ const unstableIds = { http: 5, kv: 6, net: 7, - process: 8, - temporal: 9, - unsafeProto: 10, - webgpu: 11, - workerOptions: 12, + otel: 8, + process: 9, + temporal: 10, + unsafeProto: 11, + webgpu: 12, + workerOptions: 13, }; const denoNsUnstableById = { __proto__: null }; @@ -181,4 +183,9 @@ denoNsUnstableById[unstableIds.webgpu] = { // denoNsUnstableById[unstableIds.workerOptions] = { __proto__: null } +denoNsUnstableById[unstableIds.otel] = { + tracing: telemetry.tracing, + metrics: telemetry.metrics, +}; + export { denoNs, denoNsUnstableById, unstableIds }; -- cgit v1.2.3 From de34c7ed29bcce8b46a65f5effe45090b8493ba5 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Thu, 14 Nov 2024 14:11:29 +0100 Subject: feat(cli): add `--unstable-node-globals` flag (#26617) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds a new `--unstable-node-globals` flag to expose Node globals by default. Fixes https://github.com/denoland/deno/issues/26611 --------- Co-authored-by: Bartek IwaƄczuk --- runtime/js/90_deno_ns.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'runtime/js/90_deno_ns.js') diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 11f618ce2..079338510 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -144,12 +144,13 @@ const unstableIds = { http: 5, kv: 6, net: 7, - otel: 8, - process: 9, - temporal: 10, - unsafeProto: 11, - webgpu: 12, - workerOptions: 13, + nodeGlobals: 8, + otel: 9, + process: 10, + temporal: 11, + unsafeProto: 12, + webgpu: 13, + workerOptions: 14, }; const denoNsUnstableById = { __proto__: null }; -- cgit v1.2.3 From 594a99817cbe44553b2c288578fbba8e1e9c1907 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Tue, 19 Nov 2024 00:55:22 +0100 Subject: feat(runtime): remove public OTEL trace API (#26854) This PR removes the public Deno.tracing.Span API. We are not confident we can ship an API that is better than the `@opentelemetry/api` API, because V8 CPED does not support us using `using` to manage span context. If this changes, we can revisit this decision. For now, users wanting custom spans can instrument their code using the `@opentelemetry/api` API and `@deno/otel`. This PR also speeds up the OTEL trace generation by a 30% by using Uint8Array instead of strings for the trace ID and span ID. --- runtime/js/90_deno_ns.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime/js/90_deno_ns.js') diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 079338510..6300f599d 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -29,7 +29,7 @@ import * as tty from "ext:runtime/40_tty.js"; import * as kv from "ext:deno_kv/01_db.ts"; import * as cron from "ext:deno_cron/01_cron.ts"; import * as webgpuSurface from "ext:deno_webgpu/02_surface.js"; -import * as telemetry from "ext:runtime/telemetry.js"; +import * as telemetry from "ext:runtime/telemetry.ts"; const denoNs = { Process: process.Process, @@ -185,8 +185,7 @@ denoNsUnstableById[unstableIds.webgpu] = { // denoNsUnstableById[unstableIds.workerOptions] = { __proto__: null } denoNsUnstableById[unstableIds.otel] = { - tracing: telemetry.tracing, - metrics: telemetry.metrics, + telemetry: telemetry.telemetry, }; export { denoNs, denoNsUnstableById, unstableIds }; -- cgit v1.2.3