diff --git a/implementations/rust/ockam/ockam_api/src/logs/default_values.rs b/implementations/rust/ockam/ockam_api/src/logs/default_values.rs index a31d0d9ffa5..84f3a058b7f 100644 --- a/implementations/rust/ockam/ockam_api/src/logs/default_values.rs +++ b/implementations/rust/ockam/ockam_api/src/logs/default_values.rs @@ -49,10 +49,14 @@ pub(crate) const DEFAULT_SPAN_EXPORT_QUEUE_SIZE: u16 = 32768; // Size of the queue used to batch logs. pub(crate) const DEFAULT_LOG_EXPORT_QUEUE_SIZE: u16 = 32768; -// Maximum time for sending log record batches when using a portal -pub(crate) const DEFAULT_FOREGROUND_LOG_EXPORT_PORTAL_CUTOFF: Duration = - Duration::from_millis(3000); +// Maximum time for sending log record batches when using a foreground node +pub(crate) const DEFAULT_FOREGROUND_LOG_EXPORT_CUTOFF: Duration = Duration::from_millis(3000); -// Maximum time for sending span batches when using a portal -pub(crate) const DEFAULT_FOREGROUND_SPAN_EXPORT_PORTAL_CUTOFF: Duration = - Duration::from_millis(3000); +// Maximum time for sending span batches when using a foreground node +pub(crate) const DEFAULT_FOREGROUND_SPAN_EXPORT_CUTOFF: Duration = Duration::from_millis(3000); + +// Maximum time for sending log record batches when using a background node +pub(crate) const DEFAULT_BACKGROUND_LOG_EXPORT_CUTOFF: Duration = Duration::from_millis(3000); + +// Maximum time for sending span batches when using a background node +pub(crate) const DEFAULT_BACKGROUND_SPAN_EXPORT_CUTOFF: Duration = Duration::from_millis(3000); diff --git a/implementations/rust/ockam/ockam_api/src/logs/env_variables.rs b/implementations/rust/ockam/ockam_api/src/logs/env_variables.rs index 81c70be36cc..ae74c59b512 100644 --- a/implementations/rust/ockam/ockam_api/src/logs/env_variables.rs +++ b/implementations/rust/ockam/ockam_api/src/logs/env_variables.rs @@ -108,14 +108,20 @@ pub(crate) const OCKAM_SPAN_EXPORT_QUEUE_SIZE: &str = "OCKAM_SPAN_EXPORT_QUEUE_S pub(crate) const OCKAM_LOG_EXPORT_QUEUE_SIZE: &str = "OCKAM_LOG_EXPORT_QUEUE_SIZE"; /// Maximum time for sending a log batch and not waiting for a response when running -/// a foreground command and using a portal to export log records. For example: 200ms -pub(crate) const OCKAM_FOREGROUND_LOG_EXPORT_PORTAL_CUTOFF: &str = - "OCKAM_FOREGROUND_LOG_EXPORT_PORTAL_CUTOFF"; +/// a foreground command export log records. For example: 200ms +pub(crate) const OCKAM_FOREGROUND_LOG_EXPORT_CUTOFF: &str = "OCKAM_FOREGROUND_LOG_EXPORT_CUTOFF"; /// Maximum time for sending a span batch and not waiting for a response when running -/// a foreground command and using a portal to export span batches. For example: 200ms -pub(crate) const OCKAM_FOREGROUND_SPAN_EXPORT_PORTAL_CUTOFF: &str = - "OCKAM_FOREGROUND_SPAN_EXPORT_PORTAL_CUTOFF"; +/// a foreground command to export span batches. For example: 200ms +pub(crate) const OCKAM_FOREGROUND_SPAN_EXPORT_CUTOFF: &str = "OCKAM_FOREGROUND_SPAN_EXPORT_CUTOFF"; + +/// Maximum time for sending a log batch and not waiting for a response when running +/// a background command to export log records. For example: 200ms +pub(crate) const OCKAM_BACKGROUND_LOG_EXPORT_CUTOFF: &str = "OCKAM_BACKGROUND_LOG_EXPORT_CUTOFF"; + +/// Maximum time for sending a span batch and not waiting for a response when running +/// a background command to export span batches. For example: 200ms +pub(crate) const OCKAM_BACKGROUND_SPAN_EXPORT_CUTOFF: &str = "OCKAM_BACKGROUND_SPAN_EXPORT_CUTOFF"; /// /// OPENTELEMETRY COLLECTOR ERRORS CONFIGURATION diff --git a/implementations/rust/ockam/ockam_api/src/logs/exporting_configuration.rs b/implementations/rust/ockam/ockam_api/src/logs/exporting_configuration.rs index 75c912943ce..23cc91e8dbd 100644 --- a/implementations/rust/ockam/ockam_api/src/logs/exporting_configuration.rs +++ b/implementations/rust/ockam/ockam_api/src/logs/exporting_configuration.rs @@ -53,9 +53,9 @@ pub struct ExportingConfiguration { /// This boolean is set on spans to distinguish internal usage for external usage is_ockam_developer: bool, /// Maximum time for exporting a batch of spans (with no response) - span_export_portal_cutoff: Option, + span_export_cutoff: Option, /// Maximum time for exporting a batch of log records (with no response) - log_export_portal_cutoff: Option, + log_export_cutoff: Option, } impl ExportingConfiguration { @@ -101,12 +101,12 @@ impl ExportingConfiguration { /// Return the maximum time to wait until sending the current batch of spans (without waiting for a response) pub fn span_export_cutoff(&self) -> Option { - self.span_export_portal_cutoff + self.span_export_cutoff } /// Return the maximum time to wait until sending the current batch of log records (without waiting for a response) pub fn log_export_cutoff(&self) -> Option { - self.log_export_portal_cutoff + self.log_export_cutoff } /// Return the URL where to export spans and log records @@ -132,8 +132,8 @@ impl ExportingConfiguration { log_export_queue_size: log_export_queue_size()?, opentelemetry_endpoint: endpoint.url(), is_ockam_developer: is_ockam_developer()?, - span_export_portal_cutoff: Some(foreground_span_export_portal_cutoff().unwrap()), - log_export_portal_cutoff: Some(foreground_log_export_portal_cutoff().unwrap()), + span_export_cutoff: Some(foreground_span_export_portal_cutoff()?), + log_export_cutoff: Some(foreground_log_export_cutoff()?), }), } } @@ -155,8 +155,8 @@ impl ExportingConfiguration { log_export_queue_size: log_export_queue_size()?, opentelemetry_endpoint: endpoint.url(), is_ockam_developer: is_ockam_developer()?, - span_export_portal_cutoff: None, - log_export_portal_cutoff: None, + span_export_cutoff: Some(background_span_export_portal_cutoff()?), + log_export_cutoff: Some(background_log_export_cutoff()?), }), } } @@ -173,8 +173,8 @@ impl ExportingConfiguration { log_export_queue_size: DEFAULT_LOG_EXPORT_QUEUE_SIZE, opentelemetry_endpoint: Self::default_opentelemetry_endpoint()?, is_ockam_developer: is_ockam_developer()?, - span_export_portal_cutoff: None, - log_export_portal_cutoff: None, + span_export_cutoff: None, + log_export_cutoff: None, }) } @@ -489,19 +489,35 @@ pub fn background_log_export_scheduled_delay() -> ockam_core::Result { ) } -/// Return the maximum time for sending log record batches when using a portal -pub fn foreground_log_export_portal_cutoff() -> ockam_core::Result { +/// Return the maximum time for sending log record batches when using a foreground node +pub fn foreground_log_export_cutoff() -> ockam_core::Result { get_env_with_default( - OCKAM_FOREGROUND_LOG_EXPORT_PORTAL_CUTOFF, - DEFAULT_FOREGROUND_LOG_EXPORT_PORTAL_CUTOFF, + OCKAM_FOREGROUND_LOG_EXPORT_CUTOFF, + DEFAULT_FOREGROUND_LOG_EXPORT_CUTOFF, ) } -/// Return the maximum time for sending span batches when using a portal +/// Return the maximum time for sending span batches when using a foreground node pub fn foreground_span_export_portal_cutoff() -> ockam_core::Result { get_env_with_default( - OCKAM_FOREGROUND_SPAN_EXPORT_PORTAL_CUTOFF, - DEFAULT_FOREGROUND_SPAN_EXPORT_PORTAL_CUTOFF, + OCKAM_FOREGROUND_SPAN_EXPORT_CUTOFF, + DEFAULT_FOREGROUND_SPAN_EXPORT_CUTOFF, + ) +} + +/// Return the maximum time for sending log record batches when using a background node +pub fn background_log_export_cutoff() -> ockam_core::Result { + get_env_with_default( + OCKAM_BACKGROUND_LOG_EXPORT_CUTOFF, + DEFAULT_BACKGROUND_LOG_EXPORT_CUTOFF, + ) +} + +/// Return the maximum time for sending span batches when using a background node +pub fn background_span_export_portal_cutoff() -> ockam_core::Result { + get_env_with_default( + OCKAM_BACKGROUND_SPAN_EXPORT_CUTOFF, + DEFAULT_BACKGROUND_SPAN_EXPORT_CUTOFF, ) } diff --git a/implementations/rust/ockam/ockam_command/src/environment/static/env_info.txt b/implementations/rust/ockam/ockam_command/src/environment/static/env_info.txt index 92f1334b05b..aece9f207d9 100644 --- a/implementations/rust/ockam/ockam_command/src/environment/static/env_info.txt +++ b/implementations/rust/ockam/ockam_command/src/environment/static/env_info.txt @@ -28,13 +28,6 @@ Database - OCKAM_POSTGRES_USER: Postgres database user. If it is not set, no authorization will be used to access the database. - OCKAM_POSTGRES_PASSWORD: Postgres database password. If it is not set, no authorization will be used to access the database. -- OCKAM_LOGGING: set this variable to any value in order to enable logging. -- OCKAM_LOG_LEVEL: a `string` that defines the verbosity of the logs when the `--verbose` argument is not passed: `info`, `warn`, `error`, `debug` or `trace`. Default value: `debug`. -- OCKAM_LOG_FORMAT: a `string` that overrides the default format of the logs: `default`, `json`, or `pretty`. Default value: `default`. -- OCKAM_LOG_MAX_SIZE_MB: an `integer` that defines the maximum size of a log file in MB. Default value `100`. -- OCKAM_LOG_MAX_FILES: an `integer` that defines the maximum number of log files to keep per node. Default value `60`. -- OCKAM_LOG_CRATES_FILTER: a filter for log messages based on crate names: `all`, `default`, comma-separated list of crate names. Default value: `default`, i.e. the list of `ockam` crates. - Tracing - OCKAM_OPENTELEMETRY_EXPORT: set this variable to a false value to disable tracing: `0`, `false`, `no`. Default value: `true` - OCKAM_OPENTELEMETRY_ENDPOINT: the URL of an OpenTelemetry collector accepting gRPC. @@ -48,9 +41,10 @@ Tracing - OCKAM_SPAN_EXPORT_QUEUE_SIZE: Size of the queue used to store batched spans before export. When the queue is full, spans are dropped. Default value: `32768` - OCKAM_LOG_EXPORT_QUEUE_SIZE: Size of the queue used to store batched log records before export. When the queue is full, log records are dropped. Default value: `32768` - OCKAM_TRACING_GLOBAL_ERROR_HANDLER: Configuration for printing tracing/logging errors: `console`, `logfile`, `off`. Default value: `logfile`. -- OCKAM_FOREGROUND_LOG_EXPORT_PORTAL_CUTOFF: Cutoff time for sending log records batches to an OpenTelemetry portal inlet, without waiting for a response. Default value: `3s`. -- OCKAM_FOREGROUND_SPAN_EXPORT_PORTAL_CUTOFF: Cutoff time for sending span batches to an OpenTelemetry portal inlet, without waiting for a response. Default value: `3s`. -- OCKAM_TRACING_GLOBAL_ERROR_HANDLER: Configuration for printing tracing/logging errors: `console`, `logfile`, `off`. Default value: `console`. +- OCKAM_FOREGROUND_LOG_EXPORT_CUTOFF: Cutoff time for sending log records batches to an OpenTelemetry foreground node, without waiting for a response. Default value: `3s`. +- OCKAM_FOREGROUND_SPAN_EXPORT_CUTOFF: Cutoff time for sending span batches to an OpenTelemetry foreground inlet, without waiting for a response. Default value: `3s`. +- OCKAM_BACKGROUND_LOG_EXPORT_CUTOFF: Cutoff time for sending log records batches to an OpenTelemetry baclground node, without waiting for a response. Default value: `3s`. +- OCKAM_BACKGROUND_SPAN_EXPORT_CUTOFF: Cutoff time for sending span batches to an OpenTelemetry background inlet, without waiting for a response. Default value: `3s`. UDP Puncture - OCKAM_RENDEZVOUS_SERVER: set this variable to the hostname and port of the Rendezvous service