mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
parent
a33dae6a2a
commit
f360d61d64
2 changed files with 12 additions and 11 deletions
14
cli/main.rs
14
cli/main.rs
|
@ -51,7 +51,6 @@ use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics;
|
|||
use deno_runtime::WorkerExecutionMode;
|
||||
pub use deno_runtime::UNSTABLE_FEATURES;
|
||||
use deno_telemetry::OtelConfig;
|
||||
use deno_telemetry::OtelConsoleConfig;
|
||||
use deno_terminal::colors;
|
||||
use factory::CliFactory;
|
||||
|
||||
|
@ -490,15 +489,10 @@ fn resolve_flags_and_init(
|
|||
|
||||
let otel_config = flags.otel_config();
|
||||
init_logging(flags.log_level, Some(otel_config.clone()));
|
||||
if otel_config.metrics_enabled
|
||||
|| otel_config.tracing_enabled
|
||||
|| !matches!(otel_config.console, OtelConsoleConfig::Ignore)
|
||||
{
|
||||
deno_telemetry::init(
|
||||
deno_lib::version::otel_runtime_config(),
|
||||
otel_config.clone(),
|
||||
)?;
|
||||
}
|
||||
deno_telemetry::init(
|
||||
deno_lib::version::otel_runtime_config(),
|
||||
otel_config.clone(),
|
||||
)?;
|
||||
|
||||
// TODO(bartlomieju): remove in Deno v2.5 and hard error then.
|
||||
if flags.unstable_config.legacy_flag_enabled {
|
||||
|
|
|
@ -162,7 +162,7 @@ pub enum OtelPropagators {
|
|||
None = 2,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[repr(u8)]
|
||||
pub enum OtelConsoleConfig {
|
||||
Ignore = 0,
|
||||
|
@ -636,6 +636,13 @@ pub fn init(
|
|||
rt_config: OtelRuntimeConfig,
|
||||
config: OtelConfig,
|
||||
) -> deno_core::anyhow::Result<()> {
|
||||
if !config.metrics_enabled
|
||||
&& !config.tracing_enabled
|
||||
&& config.console == OtelConsoleConfig::Ignore
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Parse the `OTEL_EXPORTER_OTLP_PROTOCOL` variable. The opentelemetry_*
|
||||
// crates don't do this automatically.
|
||||
// TODO(piscisaureus): enable GRPC support.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue