diff options
author | snek <snek@deno.com> | 2024-11-13 11:38:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-13 10:38:46 +0000 |
commit | aa546189be730163ee5370029e4dfdb3b454ab96 (patch) | |
tree | 4407643e6908f82c9ac31d9ae5faf04b3ab8d413 /runtime/worker_bootstrap.rs | |
parent | 7becd83a3828b35331d0fcb82c64146e520f154b (diff) |
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>
Diffstat (limited to 'runtime/worker_bootstrap.rs')
-rw-r--r-- | runtime/worker_bootstrap.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index 3f3c25c5e..dc989a1c0 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -1,5 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +use crate::ops::otel::OtelConfig; use deno_core::v8; use deno_core::ModuleSpecifier; use serde::Serialize; @@ -118,6 +119,8 @@ pub struct BootstrapOptions { // Used by `deno serve` pub serve_port: Option<u16>, pub serve_host: Option<String>, + // OpenTelemetry output options. If `None`, OpenTelemetry is disabled. + pub otel_config: Option<OtelConfig>, } impl Default for BootstrapOptions { @@ -152,6 +155,7 @@ impl Default for BootstrapOptions { mode: WorkerExecutionMode::None, serve_port: Default::default(), serve_host: Default::default(), + otel_config: None, } } } @@ -193,6 +197,8 @@ struct BootstrapV8<'a>( Option<bool>, // serve worker count Option<usize>, + // OTEL config + Box<[u8]>, ); impl BootstrapOptions { @@ -219,6 +225,11 @@ impl BootstrapOptions { self.serve_host.as_deref(), serve_is_main, serve_worker_count, + if let Some(otel_config) = self.otel_config.as_ref() { + Box::new([otel_config.console as u8]) + } else { + Box::new([]) + }, ); bootstrap.serialize(ser).unwrap() |