-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat(publisher): Introduce Telemetry #299
Conversation
This commit improves the `FuelCoreLike` trait definition allowing us to wrap implementors in a `Arc` reference
6bf7099
to
06e8bd3
Compare
@@ -11,6 +11,7 @@ SURREALDB_URL=127.0.0.1:8000 | |||
SURREALDB_USER=root | |||
SURREALDB_PASS=root | |||
CONCURRENCY_LIMIT=16 | |||
USE_ELASTIC_LOGGING=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to include this environment variable before deploying
#[arg( | ||
long, | ||
value_name = "ELOG", | ||
env = "USE_ELASTIC_LOGGING", | ||
default_value = "false", | ||
help = "Use elasticsearch logging." | ||
)] | ||
pub use_elastic_logging: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this in a bid to reduce the CLI args.
// fn set_panic_hook(&mut self) { | ||
// let nats_client = self.nats_client.clone(); | ||
// let fuel_service = Arc::clone(&self.fuel_service); | ||
// std::panic::set_hook(Box::new(move |panic_info| { | ||
// let payload = panic_info | ||
// .payload() | ||
// .downcast_ref::<&str>() | ||
// .unwrap_or(&"Unknown panic"); | ||
// tracing::error!("Publisher panicked with a message: {:?}", payload); | ||
// let handle = tokio::runtime::Handle::current(); | ||
// let nats_client = nats_client.clone(); | ||
// let fuel_service = Arc::clone(&fuel_service); | ||
// handle.spawn(async move { | ||
// Publisher::flush_await_all_streams(&nats_client).await; | ||
// Publisher::stop_fuel_service(&fuel_service).await; | ||
// std::process::exit(1); | ||
// }); | ||
// })); | ||
// } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need a new small task for graceful shutdown when Publisher panics
fn maybe_elog(&self, entry: LogEntry) { | ||
if let Some(elastic_search) = &self.elastic_search { | ||
self.runtime | ||
.spawn(elastic_search::log(elastic_search.clone(), entry)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happens within the Telemetry's dedicated ThreadPool, so, we no longer have to delay processing the next block because of ElasticSearch
This change consolidates all things related to metrics and logging in a dedicated Telemetry process to give room for processing performance when publishing.
87704db
to
49f4e0c
Compare
c66d993
to
621507c
Compare
.enable_all() | ||
.build()?; | ||
|
||
runtime.block_on(async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need these block_ons
let server_handle = server.handle(); | ||
// spawn the server in the background | ||
tokio::spawn(async move { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been server_runtime.spawn
let (tx, rx) = mpsc::channel::<RuntimeMessage>(100); | ||
let cli = cli.clone(); | ||
|
||
tokio::spawn({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shoould have been publisher_runtime.spawn
|
||
tokio::spawn(async move { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been fuel_core_runtime.spawn
@@ -1,188 +1,64 @@ | |||
//! This binary subscribes to events emitted from a Fuel client or node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the main
binary in its former shape for now, and then plan around the runtime architecture for each of its processes.
54f7844
to
d943cde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test running the entire stack locally to ensure everything is working and the main thread is not being slowing down as it was before?
This change consolidates all things related to metrics and logging in a dedicated
Telemetry process to give room for processing performance when publishing.
Closes DS-109