mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Merge #246
246: Stop logging the no space left on device error r=curquiza a=irevoire closes #208 @qdequele what do you think of that? Are there any other errors we need to ignore? As you can see in the code, once we are in `Sentry` the error has already been converted to a `String` so the only thing we can do to see if we need to send the error or not is to match the `String` against our error message. If we have a lot of other logs we want to ignore I would suggest prefixing all the logs with something like: ``` User error: No space left on device ``` So in Sentry, we could just check if the log start by `User error:` and ignore all these errors at once Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
commit
712abf4c5f
@ -7,6 +7,8 @@ use structopt::StructOpt;
|
|||||||
|
|
||||||
#[cfg(all(not(debug_assertions), feature = "analytics"))]
|
#[cfg(all(not(debug_assertions), feature = "analytics"))]
|
||||||
use meilisearch_http::analytics;
|
use meilisearch_http::analytics;
|
||||||
|
#[cfg(all(not(debug_assertions), feature = "analytics"))]
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
@ -21,7 +23,7 @@ async fn main() -> Result<(), MainError> {
|
|||||||
|
|
||||||
let mut log_builder = env_logger::Builder::new();
|
let mut log_builder = env_logger::Builder::new();
|
||||||
log_builder.parse_filters(&opt.log_level);
|
log_builder.parse_filters(&opt.log_level);
|
||||||
if opt.log_level == "info" {
|
if opt.log_level == "info" {
|
||||||
// if we are in info we only allow the warn log_level for milli
|
// if we are in info we only allow the warn log_level for milli
|
||||||
log_builder.filter_module("milli", log::LevelFilter::Warn);
|
log_builder.filter_module("milli", log::LevelFilter::Warn);
|
||||||
}
|
}
|
||||||
@ -46,6 +48,14 @@ async fn main() -> Result<(), MainError> {
|
|||||||
let sentry = sentry::init(sentry::ClientOptions {
|
let sentry = sentry::init(sentry::ClientOptions {
|
||||||
release: sentry::release_name!(),
|
release: sentry::release_name!(),
|
||||||
dsn: Some(SENTRY_DSN.parse()?),
|
dsn: Some(SENTRY_DSN.parse()?),
|
||||||
|
before_send: Some(Arc::new(|event| {
|
||||||
|
event
|
||||||
|
.message
|
||||||
|
.as_ref()
|
||||||
|
.map(|msg| msg.to_lowercase().contains("no space left on device"))
|
||||||
|
.unwrap_or(false)
|
||||||
|
.then(|| event)
|
||||||
|
})),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
// sentry must stay alive as long as possible
|
// sentry must stay alive as long as possible
|
||||||
|
Loading…
Reference in New Issue
Block a user