mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
feat(analytics): send the whole set of cli options instead of only the snapshot
This commit is contained in:
parent
7e2f6063ae
commit
7828da15c3
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -494,6 +494,7 @@ version = "4.0.13"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "956ffc5b0ec7d7a6949e3f21fd63ba5af4cffdc2ba1e0b7bf62b481458c4ae7f"
|
checksum = "956ffc5b0ec7d7a6949e3f21fd63ba5af4cffdc2ba1e0b7bf62b481458c4ae7f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"serde",
|
||||||
"utf8-width",
|
"utf8-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ arc-swap = "1.3.2"
|
|||||||
async-stream = "0.3.2"
|
async-stream = "0.3.2"
|
||||||
async-trait = "0.1.51"
|
async-trait = "0.1.51"
|
||||||
bstr = "0.2.17"
|
bstr = "0.2.17"
|
||||||
byte-unit = { version = "4.0.12", default-features = false, features = ["std"] }
|
byte-unit = { version = "4.0.12", default-features = false, features = ["std", "serde"] }
|
||||||
bytes = "1.1.0"
|
bytes = "1.1.0"
|
||||||
chrono = { version = "0.4.19", features = ["serde"] }
|
chrono = { version = "0.4.19", features = ["serde"] }
|
||||||
crossbeam-channel = "0.5.1"
|
crossbeam-channel = "0.5.1"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::collections::{BinaryHeap, HashMap, HashSet};
|
use std::collections::{BinaryHeap, HashMap, HashSet};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
@ -211,10 +211,30 @@ impl Segment {
|
|||||||
"server_provider": std::env::var("MEILI_SERVER_PROVIDER").ok(),
|
"server_provider": std::env::var("MEILI_SERVER_PROVIDER").ok(),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
let infos = json!({
|
// The infos are all cli option except every option containing sensitive information.
|
||||||
"env": opt.env.clone(),
|
// We consider an information as sensible if it contains a path, an address or a key.
|
||||||
"has_snapshot": opt.schedule_snapshot,
|
let infos = {
|
||||||
});
|
// First we see if any sensitive fields were used.
|
||||||
|
let db_path = opt.db_path != PathBuf::from("./data.ms");
|
||||||
|
let import_dump = opt.import_dump.is_some();
|
||||||
|
let dumps_dir = opt.dumps_dir != PathBuf::from("dumps/");
|
||||||
|
let import_snapshot = opt.import_snapshot.is_some();
|
||||||
|
let snapshots_dir = opt.snapshot_dir != PathBuf::from("snapshots/");
|
||||||
|
let http_addr = opt.http_addr != "127.0.0.1:7700";
|
||||||
|
|
||||||
|
let mut infos = serde_json::to_value(opt).unwrap();
|
||||||
|
|
||||||
|
// Then we overwrite all sensitive field with a boolean representing if
|
||||||
|
// the feature was used or not.
|
||||||
|
infos["db_path"] = json!(db_path);
|
||||||
|
infos["import_dump"] = json!(import_dump);
|
||||||
|
infos["dumps_dir"] = json!(dumps_dir);
|
||||||
|
infos["import_snapshot"] = json!(import_snapshot);
|
||||||
|
infos["snapshot_dir"] = json!(snapshots_dir);
|
||||||
|
infos["http_addr"] = json!(http_addr);
|
||||||
|
|
||||||
|
infos
|
||||||
|
};
|
||||||
|
|
||||||
let number_of_documents = stats
|
let number_of_documents = stats
|
||||||
.indexes
|
.indexes
|
||||||
|
@ -14,10 +14,11 @@ use rustls::{
|
|||||||
RootCertStore,
|
RootCertStore,
|
||||||
};
|
};
|
||||||
use rustls_pemfile::{certs, pkcs8_private_keys, rsa_private_keys};
|
use rustls_pemfile::{certs, pkcs8_private_keys, rsa_private_keys};
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
const POSSIBLE_ENV: [&str; 2] = ["development", "production"];
|
const POSSIBLE_ENV: [&str; 2] = ["development", "production"];
|
||||||
|
|
||||||
#[derive(Debug, Clone, Parser)]
|
#[derive(Debug, Clone, Parser, Serialize)]
|
||||||
pub struct Opt {
|
pub struct Opt {
|
||||||
/// The destination where the database must be created.
|
/// The destination where the database must be created.
|
||||||
#[clap(long, env = "MEILI_DB_PATH", default_value = "./data.ms")]
|
#[clap(long, env = "MEILI_DB_PATH", default_value = "./data.ms")]
|
||||||
@ -28,6 +29,7 @@ pub struct Opt {
|
|||||||
pub http_addr: String,
|
pub http_addr: String,
|
||||||
|
|
||||||
/// The master key allowing you to do everything on the server.
|
/// The master key allowing you to do everything on the server.
|
||||||
|
#[serde(skip)]
|
||||||
#[clap(long, env = "MEILI_MASTER_KEY")]
|
#[clap(long, env = "MEILI_MASTER_KEY")]
|
||||||
pub master_key: Option<String>,
|
pub master_key: Option<String>,
|
||||||
|
|
||||||
@ -59,33 +61,40 @@ pub struct Opt {
|
|||||||
/// This should contain PEM-format certificates
|
/// This should contain PEM-format certificates
|
||||||
/// in the right order (the first certificate should
|
/// in the right order (the first certificate should
|
||||||
/// certify KEYFILE, the last should be a root CA).
|
/// certify KEYFILE, the last should be a root CA).
|
||||||
|
#[serde(skip)]
|
||||||
#[clap(long, env = "MEILI_SSL_CERT_PATH", parse(from_os_str))]
|
#[clap(long, env = "MEILI_SSL_CERT_PATH", parse(from_os_str))]
|
||||||
pub ssl_cert_path: Option<PathBuf>,
|
pub ssl_cert_path: Option<PathBuf>,
|
||||||
|
|
||||||
/// Read private key from KEYFILE. This should be a RSA
|
/// Read private key from KEYFILE. This should be a RSA
|
||||||
/// private key or PKCS8-encoded private key, in PEM format.
|
/// private key or PKCS8-encoded private key, in PEM format.
|
||||||
|
#[serde(skip)]
|
||||||
#[clap(long, env = "MEILI_SSL_KEY_PATH", parse(from_os_str))]
|
#[clap(long, env = "MEILI_SSL_KEY_PATH", parse(from_os_str))]
|
||||||
pub ssl_key_path: Option<PathBuf>,
|
pub ssl_key_path: Option<PathBuf>,
|
||||||
|
|
||||||
/// Enable client authentication, and accept certificates
|
/// Enable client authentication, and accept certificates
|
||||||
/// signed by those roots provided in CERTFILE.
|
/// signed by those roots provided in CERTFILE.
|
||||||
#[clap(long, env = "MEILI_SSL_AUTH_PATH", parse(from_os_str))]
|
#[clap(long, env = "MEILI_SSL_AUTH_PATH", parse(from_os_str))]
|
||||||
|
#[serde(skip)]
|
||||||
pub ssl_auth_path: Option<PathBuf>,
|
pub ssl_auth_path: Option<PathBuf>,
|
||||||
|
|
||||||
/// Read DER-encoded OCSP response from OCSPFILE and staple to certificate.
|
/// Read DER-encoded OCSP response from OCSPFILE and staple to certificate.
|
||||||
/// Optional
|
/// Optional
|
||||||
|
#[serde(skip)]
|
||||||
#[clap(long, env = "MEILI_SSL_OCSP_PATH", parse(from_os_str))]
|
#[clap(long, env = "MEILI_SSL_OCSP_PATH", parse(from_os_str))]
|
||||||
pub ssl_ocsp_path: Option<PathBuf>,
|
pub ssl_ocsp_path: Option<PathBuf>,
|
||||||
|
|
||||||
/// Send a fatal alert if the client does not complete client authentication.
|
/// Send a fatal alert if the client does not complete client authentication.
|
||||||
|
#[serde(skip)]
|
||||||
#[clap(long, env = "MEILI_SSL_REQUIRE_AUTH")]
|
#[clap(long, env = "MEILI_SSL_REQUIRE_AUTH")]
|
||||||
pub ssl_require_auth: bool,
|
pub ssl_require_auth: bool,
|
||||||
|
|
||||||
/// SSL support session resumption
|
/// SSL support session resumption
|
||||||
|
#[serde(skip)]
|
||||||
#[clap(long, env = "MEILI_SSL_RESUMPTION")]
|
#[clap(long, env = "MEILI_SSL_RESUMPTION")]
|
||||||
pub ssl_resumption: bool,
|
pub ssl_resumption: bool,
|
||||||
|
|
||||||
/// SSL support tickets.
|
/// SSL support tickets.
|
||||||
|
#[serde(skip)]
|
||||||
#[clap(long, env = "MEILI_SSL_TICKETS")]
|
#[clap(long, env = "MEILI_SSL_TICKETS")]
|
||||||
pub ssl_tickets: bool,
|
pub ssl_tickets: bool,
|
||||||
|
|
||||||
@ -127,6 +136,7 @@ pub struct Opt {
|
|||||||
#[clap(long, env = "MEILI_LOG_LEVEL", default_value = "info")]
|
#[clap(long, env = "MEILI_LOG_LEVEL", default_value = "info")]
|
||||||
pub log_level: String,
|
pub log_level: String,
|
||||||
|
|
||||||
|
#[serde(skip)]
|
||||||
#[clap(skip)]
|
#[clap(skip)]
|
||||||
pub indexer_options: IndexerOpts,
|
pub indexer_options: IndexerOpts,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user