mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-29 16:37:07 +00:00
modify logger level from info to error (#744)
* modify logger level from `info` to `error` * fix test * improve tokio runtime config * add rustfs helm chart files (#747) * add rustfs helm chart files * update readme file with helm chart * delete helm chart license file * fix typo in readme file * fix: restore localized samples in tests (#749) * fix: restore required localized examples * style: fix formatting issues * improve code for Observability * upgrade crates version * fix * up * fix --------- Co-authored-by: majinghe <42570491+majinghe@users.noreply.github.com> Co-authored-by: 安正超 <anzhengchao@gmail.com>
This commit is contained in:
@@ -12,12 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::GlobalError;
|
||||
use crate::{GlobalError, is_observability_enabled};
|
||||
use opentelemetry::global::meter;
|
||||
|
||||
pub(crate) mod attributes;
|
||||
mod attributes;
|
||||
mod collector;
|
||||
pub(crate) mod gpu;
|
||||
pub(crate) mod metrics;
|
||||
#[cfg(feature = "gpu")]
|
||||
mod gpu;
|
||||
mod metrics;
|
||||
|
||||
pub struct SystemObserver {}
|
||||
|
||||
@@ -25,10 +27,12 @@ impl SystemObserver {
|
||||
/// Initialize the indicator collector for the current process
|
||||
/// This function will create a new `Collector` instance and start collecting metrics.
|
||||
/// It will run indefinitely until the process is terminated.
|
||||
pub async fn init_process_observer(meter: opentelemetry::metrics::Meter) -> Result<(), GlobalError> {
|
||||
let pid = sysinfo::get_current_pid().map_err(|e| GlobalError::PidError(e.to_string()))?;
|
||||
let mut collector = collector::Collector::new(pid, meter, 30000)?;
|
||||
collector.run().await
|
||||
pub async fn init_process_observer() -> Result<(), GlobalError> {
|
||||
if is_observability_enabled() {
|
||||
let meter = meter("system");
|
||||
return SystemObserver::init_process_observer_for_pid(meter, 30000).await;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Initialize the metric collector for the specified PID process
|
||||
|
||||
Reference in New Issue
Block a user