-
Notifications
You must be signed in to change notification settings - Fork 47
feat(node): new observability architecture + events #1053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 25 commits
06eb54a
46629ad
89106eb
f756bd1
3780b2d
2c9f5f4
487560f
5ac87a1
2dcec96
90e092b
3ef23f3
31dc460
a6bc67a
92b9d5f
b693a80
366069c
deae3bd
f78e40c
9086667
dd6e49f
43e7d51
4eb611f
d4e8a54
053d614
71a57cf
2093d38
8c63b8c
e590217
1ecb44f
2a0b425
e7e7cb5
0e7c1f1
3a94fed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ use clap::{Args, Parser, Subcommand}; | |
| use config::ConfigArgs; | ||
| use debug::DebugArgs; | ||
| use fvm_shared::address::Network; | ||
| use ipc_observability::traces::FileLayerConfig; | ||
| use lazy_static::lazy_static; | ||
| use tracing_subscriber::EnvFilter; | ||
|
|
||
|
|
@@ -27,7 +28,7 @@ pub mod run; | |
| mod log; | ||
| mod parse; | ||
|
|
||
| use log::{parse_log_level, LogLevel}; | ||
| use log::{parse_log_level, parse_rotation_kind, LogLevel, RotationKind}; | ||
| use parse::parse_network; | ||
|
|
||
| lazy_static! { | ||
|
|
@@ -102,13 +103,44 @@ pub struct Options { | |
| #[arg(long, env = "FM_CONFIG_DIR")] | ||
| config_dir: Option<PathBuf>, | ||
|
|
||
| // TODO Karel - move all FM_LOG_FILE* flags to a configuration file instead | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's land the final config experience before merging this to main. Agree that this should be configured via the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright - there is an issue for it. I can pick it up once we finish review of this PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #1078 dropping it here to have the configuration PR linked. It's almost done! |
||
|
|
||
| // Enable logging to a file. | ||
| #[arg(long, env = "FM_LOG_FILE_ENABLED")] | ||
| pub log_file_enabled: Option<bool>, | ||
|
|
||
| /// Set a custom directory for ipc log files. | ||
| #[arg(long, env = "FM_LOG_DIR")] | ||
| #[arg(long, env = "FM_LOG_FILE_DIR")] | ||
| pub log_dir: Option<PathBuf>, | ||
|
|
||
| /// Set a custom prefix for ipc log files. | ||
| #[arg(long, env = "FM_LOG_FILE_PREFIX")] | ||
| pub log_file_prefix: Option<String>, | ||
| #[arg(long, env = "FM_LOG_FILE_MAX_FILES")] | ||
| pub max_log_files: Option<usize>, | ||
|
|
||
| #[arg( | ||
| long, | ||
| default_value = "daily", | ||
| value_enum, | ||
| env = "FM_LOG_FILE_ROTATION", | ||
| help = "The kind of rotation to use for log files. Options: minutely, hourly, daily, never.", | ||
| value_parser = parse_rotation_kind, | ||
| )] | ||
| pub log_files_rotation: Option<RotationKind>, | ||
|
|
||
| #[arg( | ||
| long, | ||
| env = "FM_LOG_FILE_DOMAINS_FILTER", | ||
| help = "Filter log events by domains. Only events from the specified domains will be logged. Comma separated.", | ||
| value_delimiter = ',' | ||
| )] | ||
| pub domains_filter: Option<Vec<String>>, | ||
|
|
||
| #[arg( | ||
| long, | ||
| env = "FM_LOG_FILE_EVENTS_FILTER", | ||
| help = "Filter log events by name. Only events with the specified names will be logged. Comma separated.", | ||
| value_delimiter = ',' | ||
| )] | ||
| pub events_filter: Option<Vec<String>>, | ||
|
|
||
| /// Optionally override the default configuration. | ||
| #[arg(short, long, default_value = "dev")] | ||
|
|
@@ -162,6 +194,17 @@ impl Options { | |
| } | ||
| } | ||
|
|
||
| pub fn log_file_config(&self) -> FileLayerConfig { | ||
| FileLayerConfig { | ||
| enabled: self.log_file_enabled.unwrap_or(false), | ||
| directory: self.log_dir.clone(), | ||
| max_log_files: self.max_log_files, | ||
| rotation: self.log_files_rotation.clone(), | ||
| domain_filter: self.domains_filter.clone(), | ||
| events_filter: self.events_filter.clone(), | ||
| } | ||
| } | ||
karlem marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /// Path to the configuration directories. | ||
| /// | ||
| /// If not specified then returns the default under the home directory. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.