Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cli/src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ fn get_start_command() -> Command {
.default_missing_value("main,event")
.action(ArgAction::Append),
)
.arg(
arg!(--"enable-otel-metrics")
.help("Also export OpenTelemetry metrics from the workers --enable-otel instruments")
.action(ArgAction::SetTrue),
)
.arg(
arg!(--"otel-console" <MODE>)
// .env("OTEL_DENO_CONSOLE")
Expand Down
6 changes: 6 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ fn main() -> Result<ExitCode, anyhow::Error> {
.cloned()
.collect::<Vec<_>>();

let otel_metrics = sub_matches
.get_one::<bool>("enable-otel-metrics")
.cloned()
.unwrap_or_default();

let otel_console = sub_matches
.get_one::<OtelConsoleConfig>("otel-console")
.cloned()
Expand Down Expand Up @@ -251,6 +256,7 @@ fn main() -> Result<ExitCode, anyhow::Error> {
} else {
None
},
otel_metrics,
otel_console,

no_module_cache,
Expand Down
3 changes: 3 additions & 0 deletions crates/base/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ impl RequestIdleTimeout {
#[derive(Debug, Default, Clone, Copy)]
pub struct ServerFlags {
pub otel: Option<OtelKind>,
pub otel_metrics: bool,
pub otel_console: Option<OtelConsoleConfig>,

pub no_module_cache: bool,
Expand Down Expand Up @@ -467,6 +468,7 @@ impl Server {
if let Some(OtelKind::Event | OtelKind::Both) = flags.otel {
builder.set_otel_config(Some(OtelConfig {
tracing_enabled: true,
metrics_enabled: flags.otel_metrics,
console: flags.otel_console.unwrap_or_default(),
propagators: HashSet::from([
OtelPropagators::TraceContext,
Expand Down Expand Up @@ -522,6 +524,7 @@ impl Server {
if let Some(OtelKind::Main | OtelKind::Both) = flags.otel {
builder.set_otel_config(Some(OtelConfig {
tracing_enabled: true,
metrics_enabled: flags.otel_metrics,
console: flags.otel_console.unwrap_or_default(),
propagators: HashSet::from([
OtelPropagators::TraceContext,
Expand Down
Loading