Changed prometheus metrics feature as optional

This commit is contained in:
mohandasspat 2022-08-17 17:14:55 +05:30
parent 0b6ca73790
commit 2b8f3c26ec
4 changed files with 95 additions and 35 deletions

View file

@ -146,6 +146,10 @@ pub struct Opt {
#[clap(long, env = "MEILI_LOG_LEVEL", default_value = "info")]
pub log_level: String,
// Enables Prometheus metrics and /metrics route.
#[clap(long, requires = "enable-metrics-route")]
pub enable_metrics_route: bool,
#[serde(flatten)]
#[clap(flatten)]
pub indexer_options: IndexerOpts,
@ -161,7 +165,7 @@ impl Opt {
pub fn analytics(&self) -> bool {
!self.no_analytics
}
pub fn get_ssl_config(&self) -> anyhow::Result<Option<rustls::ServerConfig>> {
if let (Some(cert_path), Some(key_path)) = (&self.ssl_cert_path, &self.ssl_key_path) {
let config = rustls::ServerConfig::builder().with_safe_defaults();