summaryrefslogtreecommitdiff
path: root/cli/args
diff options
context:
space:
mode:
authorsnek <snek@deno.com>2024-11-14 13:16:28 +0100
committerGitHub <noreply@github.com>2024-11-14 12:16:28 +0000
commit4e899d48cffa95617266dd8f9aef54603a87ad82 (patch)
treeec667f58ccb4126ecad38bc4600d9dd8dc372ca5 /cli/args
parentcb107a762fb903973e0d0c2e4481baf2c0bc13b8 (diff)
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
Diffstat (limited to 'cli/args')
-rw-r--r--cli/args/flags.rs19
-rw-r--r--cli/args/mod.rs19
2 files changed, 21 insertions, 17 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 37f589937..720d8db3b 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -36,6 +36,7 @@ use deno_path_util::normalize_path;
use deno_path_util::url_to_file_path;
use deno_runtime::deno_permissions::PermissionsOptions;
use deno_runtime::deno_permissions::SysDescriptor;
+use deno_runtime::ops::otel::OtelConfig;
use log::debug;
use log::Level;
use serde::Deserialize;
@@ -967,6 +968,24 @@ impl Flags {
args
}
+ pub fn otel_config(&self) -> Option<OtelConfig> {
+ if self
+ .unstable_config
+ .features
+ .contains(&String::from("otel"))
+ {
+ Some(OtelConfig {
+ runtime_name: Cow::Borrowed("deno"),
+ runtime_version: Cow::Borrowed(crate::version::DENO_VERSION_INFO.deno),
+ deterministic: std::env::var("DENO_UNSTABLE_OTEL_DETERMINISTIC")
+ .is_ok(),
+ ..Default::default()
+ })
+ } else {
+ None
+ }
+ }
+
/// Extract the paths the config file should be discovered from.
///
/// Returns `None` if the config file should not be auto-discovered.
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index 5e5bae87d..50a37b334 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -823,10 +823,8 @@ impl CliOptions {
};
let msg =
format!("DANGER: TLS certificate validation is disabled {}", domains);
- #[allow(clippy::print_stderr)]
{
- // use eprintln instead of log::warn so this always gets shown
- eprintln!("{}", colors::yellow(msg));
+ log::error!("{}", colors::yellow(msg));
}
}
@@ -1131,20 +1129,7 @@ impl CliOptions {
}
pub fn otel_config(&self) -> Option<OtelConfig> {
- if self
- .flags
- .unstable_config
- .features
- .contains(&String::from("otel"))
- {
- Some(OtelConfig {
- runtime_name: Cow::Borrowed("deno"),
- runtime_version: Cow::Borrowed(crate::version::DENO_VERSION_INFO.deno),
- ..Default::default()
- })
- } else {
- None
- }
+ self.flags.otel_config()
}
pub fn env_file_name(&self) -> Option<&String> {