Merge remote-tracking branch 'origin/main' into enable-metrics-http

This commit is contained in:
bwbonanno 2023-10-16 11:51:38 -07:00
commit 12fc878640
14 changed files with 154 additions and 39 deletions

View file

@ -69,8 +69,7 @@ permissive-json-pointer = { path = "../permissive-json-pointer" }
pin-project-lite = "0.2.9"
platform-dirs = "0.3.0"
prometheus = { version = "0.13.3", features = ["process"] }
puffin = "0.16.0"
puffin_http = { version = "0.13.0", optional = true }
puffin = { version = "0.16.0", features = ["serialization"] }
rand = "0.8.5"
rayon = "1.7.0"
regex = "1.7.3"
@ -135,7 +134,6 @@ zip = { version = "0.6.4", optional = true }
[features]
default = ["analytics", "meilisearch-types/all-tokenizations", "mini-dashboard"]
analytics = ["segment"]
profile-with-puffin = ["dep:puffin_http"]
mini-dashboard = [
"actix-web-static-files",
"static-files",

View file

@ -30,10 +30,6 @@ fn setup(opt: &Opt) -> anyhow::Result<()> {
async fn main() -> anyhow::Result<()> {
let (opt, config_read_from) = Opt::try_build()?;
#[cfg(feature = "profile-with-puffin")]
let _server = puffin_http::Server::new(&format!("0.0.0.0:{}", puffin_http::DEFAULT_PORT))?;
puffin::set_scopes_on(cfg!(feature = "profile-with-puffin"));
anyhow::ensure!(
!(cfg!(windows) && opt.experimental_reduce_indexing_memory_usage),
"The `experimental-reduce-indexing-memory-usage` flag is not supported on Windows"

View file

@ -46,6 +46,8 @@ pub struct RuntimeTogglableFeatures {
pub vector_store: Option<bool>,
#[deserr(default)]
pub metrics: Option<bool>,
#[deserr(default)]
pub export_puffin_reports: Option<bool>,
}
async fn patch_features(
@ -60,11 +62,14 @@ async fn patch_features(
let features = index_scheduler.features()?;
let old_features = features.runtime_features();
let new_features = meilisearch_types::features::RuntimeTogglableFeatures {
score_details: new_features.0.score_details.unwrap_or(old_features.score_details),
vector_store: new_features.0.vector_store.unwrap_or(old_features.vector_store),
metrics: new_features.0.metrics.unwrap_or(old_features.metrics),
export_puffin_reports: new_features
.0
.export_puffin_reports
.unwrap_or(old_features.export_puffin_reports),
};
// explicitly destructure for analytics rather than using the `Serialize` implementation, because
@ -74,6 +79,7 @@ async fn patch_features(
score_details,
vector_store,
metrics,
export_puffin_reports,
} = new_features;
analytics.publish(
@ -82,6 +88,7 @@ async fn patch_features(
"score_details": score_details,
"vector_store": vector_store,
"metrics": metrics,
"export_puffin_reports": export_puffin_reports,
}),
Some(&req),
);

View file

@ -20,7 +20,8 @@ async fn experimental_features() {
{
"scoreDetails": false,
"vectorStore": false,
"metrics": false
"metrics": false,
"exportPuffinReports": false
}
"###);
@ -31,7 +32,8 @@ async fn experimental_features() {
{
"scoreDetails": false,
"vectorStore": true,
"metrics": false
"metrics": false,
"exportPuffinReports": false
}
"###);
@ -42,7 +44,8 @@ async fn experimental_features() {
{
"scoreDetails": false,
"vectorStore": true,
"metrics": false
"metrics": false,
"exportPuffinReports": false
}
"###);
@ -54,7 +57,8 @@ async fn experimental_features() {
{
"scoreDetails": false,
"vectorStore": true,
"metrics": false
"metrics": false,
"exportPuffinReports": false
}
"###);
@ -66,7 +70,8 @@ async fn experimental_features() {
{
"scoreDetails": false,
"vectorStore": true,
"metrics": false
"metrics": false,
"exportPuffinReports": false
}
"###);
}
@ -85,7 +90,8 @@ async fn experimental_feature_metrics() {
{
"scoreDetails": false,
"vectorStore": false,
"metrics": true
"metrics": true,
"exportPuffinReports": false
}
"###);
@ -105,7 +111,7 @@ async fn experimental_feature_metrics() {
meili_snap::snapshot!(code, @"400 Bad Request");
meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{
"message": "Getting metrics requires enabling the `metrics` experimental feature. See https://github.com/meilisearch/meilisearch/discussions/3518",
"message": "Getting metrics requires enabling the `metrics` experimental feature. See https://github.com/meilisearch/product/discussions/625",
"code": "feature_not_enabled",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#feature_not_enabled"
@ -132,7 +138,7 @@ async fn errors() {
meili_snap::snapshot!(code, @"400 Bad Request");
meili_snap::snapshot!(meili_snap::json_string!(response), @r###"
{
"message": "Unknown field `NotAFeature`: expected one of `scoreDetails`, `vectorStore`, `metrics`",
"message": "Unknown field `NotAFeature`: expected one of `scoreDetails`, `vectorStore`, `metrics`, `exportPuffinReports`",
"code": "bad_request",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#bad_request"