mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
Fix the sysinfo errors
This commit is contained in:
parent
9f9ad4cc05
commit
5e0268d40e
@ -18,7 +18,7 @@ use segment::message::{Identify, Track, User};
|
|||||||
use segment::{AutoBatcher, Batcher, HttpClient};
|
use segment::{AutoBatcher, Batcher, HttpClient};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
use sysinfo::{DiskExt, System, SystemExt};
|
use sysinfo::{Disks, System};
|
||||||
use time::OffsetDateTime;
|
use time::OffsetDateTime;
|
||||||
use tokio::select;
|
use tokio::select;
|
||||||
use tokio::sync::mpsc::{self, Receiver, Sender};
|
use tokio::sync::mpsc::{self, Receiver, Sender};
|
||||||
@ -386,16 +386,17 @@ impl Segment {
|
|||||||
fn compute_traits(opt: &Opt, stats: Stats) -> Value {
|
fn compute_traits(opt: &Opt, stats: Stats) -> Value {
|
||||||
static FIRST_START_TIMESTAMP: Lazy<Instant> = Lazy::new(Instant::now);
|
static FIRST_START_TIMESTAMP: Lazy<Instant> = Lazy::new(Instant::now);
|
||||||
static SYSTEM: Lazy<Value> = Lazy::new(|| {
|
static SYSTEM: Lazy<Value> = Lazy::new(|| {
|
||||||
|
let disks = Disks::new_with_refreshed_list();
|
||||||
let mut sys = System::new_all();
|
let mut sys = System::new_all();
|
||||||
sys.refresh_all();
|
sys.refresh_all();
|
||||||
let kernel_version =
|
let kernel_version = System::kernel_version()
|
||||||
sys.kernel_version().and_then(|k| k.split_once('-').map(|(k, _)| k.to_string()));
|
.and_then(|k| k.split_once('-').map(|(k, _)| k.to_string()));
|
||||||
json!({
|
json!({
|
||||||
"distribution": sys.name(),
|
"distribution": System::name(),
|
||||||
"kernel_version": kernel_version,
|
"kernel_version": kernel_version,
|
||||||
"cores": sys.cpus().len(),
|
"cores": sys.cpus().len(),
|
||||||
"ram_size": sys.total_memory(),
|
"ram_size": sys.total_memory(),
|
||||||
"disk_size": sys.disks().iter().map(|disk| disk.total_space()).max(),
|
"disk_size": disks.iter().map(|disk| disk.total_space()).max(),
|
||||||
"server_provider": std::env::var("MEILI_SERVER_PROVIDER").ok(),
|
"server_provider": std::env::var("MEILI_SERVER_PROVIDER").ok(),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -20,7 +20,7 @@ use rustls::server::{
|
|||||||
use rustls::RootCertStore;
|
use rustls::RootCertStore;
|
||||||
use rustls_pemfile::{certs, pkcs8_private_keys, rsa_private_keys};
|
use rustls_pemfile::{certs, pkcs8_private_keys, rsa_private_keys};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sysinfo::{RefreshKind, System, SystemExt};
|
use sysinfo::{RefreshKind, System};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
const POSSIBLE_ENV: [&str; 2] = ["development", "production"];
|
const POSSIBLE_ENV: [&str; 2] = ["development", "production"];
|
||||||
|
Loading…
Reference in New Issue
Block a user