From 3373e87b3146fe10aaf8135d1dbf3c04423bc061 Mon Sep 17 00:00:00 2001 From: Serhii Tatarintsev Date: Tue, 8 Oct 2024 17:45:53 +0200 Subject: [PATCH 1/9] Update mobc and metrics crates mobc update includes fixes from https://github.com/importcjj/mobc/pull/99 Rest of the PR is update to new api of the `metrics` crate. Close prisma/team-orm#1317 --- Cargo.lock | 124 +++++++++++------- Cargo.toml | 1 + quaint/Cargo.toml | 4 +- quaint/src/connector/metrics.rs | 8 +- quaint/src/connector/transaction.rs | 8 +- .../src/interface/transaction.rs | 8 +- .../src/root_queries/mod.rs | 7 +- .../core/src/executor/execute_operation.rs | 21 +-- query-engine/driver-adapters/Cargo.toml | 2 +- query-engine/driver-adapters/src/proxy.rs | 4 +- .../driver-adapters/src/transaction.rs | 6 +- query-engine/metrics/Cargo.toml | 4 +- query-engine/metrics/src/lib.rs | 106 +++++++-------- query-engine/metrics/src/recorder.rs | 20 +-- 14 files changed, 165 insertions(+), 158 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4b6a9cc21d..c0d80fa7557 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom 0.2.11", @@ -41,15 +41,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "aho-corasick" version = "1.0.3" @@ -447,7 +438,7 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8a88e82b9106923b5c4d6edfca9e7db958d4e98a478ec115022e81b9b38e2c8" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.11", "base64 0.13.1", "bitvec", "chrono", @@ -1226,7 +1217,7 @@ dependencies = [ "expect-test", "futures", "js-sys", - "metrics 0.18.1", + "metrics 0.23.0", "napi", "napi-derive", "once_cell", @@ -1805,7 +1796,7 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.8.7", + "ahash 0.8.11", "allocator-api2", ] @@ -2500,9 +2491,9 @@ dependencies = [ [[package]] name = "metrics" -version = "0.18.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e52eb6380b6d2a10eb3434aec0885374490f5b82c8aaf5cd487a183c98be834" +checksum = "142c53885123b68d94108295a09d4afe1a1388ed95b54d5dacd9a454753030f2" dependencies = [ "ahash 0.7.8", "metrics-macros", @@ -2510,12 +2501,12 @@ dependencies = [ [[package]] name = "metrics" -version = "0.19.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142c53885123b68d94108295a09d4afe1a1388ed95b54d5dacd9a454753030f2" +checksum = "884adb57038347dfbaf2d5065887b6cf4312330dc8e94bc30a1a839bd79d3261" dependencies = [ - "ahash 0.7.8", - "metrics-macros", + "ahash 0.8.11", + "portable-atomic", ] [[package]] @@ -2530,7 +2521,7 @@ dependencies = [ "metrics 0.19.0", "metrics-util 0.13.0", "parking_lot 0.11.2", - "quanta", + "quanta 0.9.3", "thiserror", "tokio", "tracing", @@ -2549,40 +2540,38 @@ dependencies = [ [[package]] name = "metrics-util" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65a9e83b833e1d2e07010a386b197c13aa199bbd0fca5cf69bfa147972db890a" +checksum = "fd1f4b69bef1e2b392b2d4a12902f2af90bb438ba4a66aa222d1023fa6561b50" dependencies = [ - "aho-corasick 0.7.20", "atomic-shim", "crossbeam-epoch", "crossbeam-utils", "hashbrown 0.11.2", - "indexmap 1.9.3", - "metrics 0.18.1", + "metrics 0.19.0", "num_cpus", - "ordered-float", "parking_lot 0.11.2", - "quanta", - "radix_trie", - "sketches-ddsketch", + "quanta 0.9.3", + "sketches-ddsketch 0.1.3", ] [[package]] name = "metrics-util" -version = "0.13.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1f4b69bef1e2b392b2d4a12902f2af90bb438ba4a66aa222d1023fa6561b50" +checksum = "4259040465c955f9f2f1a4a8a16dc46726169bca0f88e8fb2dbeced487c3e828" dependencies = [ - "atomic-shim", + "aho-corasick", "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.11.2", - "metrics 0.19.0", + "hashbrown 0.14.5", + "indexmap 2.2.2", + "metrics 0.23.0", "num_cpus", - "parking_lot 0.11.2", - "quanta", - "sketches-ddsketch", + "ordered-float", + "quanta 0.12.3", + "radix_trie", + "sketches-ddsketch 0.2.2", ] [[package]] @@ -2620,9 +2609,8 @@ dependencies = [ [[package]] name = "mobc" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90eb49dc5d193287ff80e72a86f34cfb27aae562299d22fea215e06ea1059dd3" +version = "0.8.4" +source = "git+https://github.com/SevInf/mobc.git?branch=metrics-guards#da80095bc4e6777991f5e20328008e91f1c03573" dependencies = [ "async-trait", "futures-channel", @@ -2630,7 +2618,7 @@ dependencies = [ "futures-timer", "futures-util", "log", - "metrics 0.18.1", + "metrics 0.23.0", "thiserror", "tokio", "tracing", @@ -3217,9 +3205,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "2.10.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +checksum = "44d501f1a72f71d3c063a6bbc8f7271fa73aa09fe5d6283b6571e2ed176a2537" dependencies = [ "num-traits", ] @@ -3515,6 +3503,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "portable-atomic" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" + [[package]] name = "postgres-native-tls" version = "0.5.0" @@ -3842,7 +3836,7 @@ dependencies = [ "indoc 0.3.6", "itertools 0.12.0", "lru-cache", - "metrics 0.18.1", + "metrics 0.23.0", "mobc", "mysql_async", "names 0.11.0", @@ -3906,12 +3900,27 @@ dependencies = [ "libc", "mach", "once_cell", - "raw-cpuid", + "raw-cpuid 10.7.0", "wasi 0.10.2+wasi-snapshot-preview1", "web-sys", "winapi", ] +[[package]] +name = "quanta" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid 11.2.0", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + [[package]] name = "query-connector" version = "0.1.0" @@ -4069,9 +4078,9 @@ name = "query-engine-metrics" version = "0.1.0" dependencies = [ "expect-test", - "metrics 0.18.1", + "metrics 0.23.0", "metrics-exporter-prometheus", - "metrics-util 0.12.1", + "metrics-util 0.17.0", "once_cell", "parking_lot 0.12.1", "serde", @@ -4395,6 +4404,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "raw-cpuid" +version = "11.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" +dependencies = [ + "bitflags 2.4.0", +] + [[package]] name = "rayon" version = "1.7.0" @@ -4450,7 +4468,7 @@ version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ - "aho-corasick 1.0.3", + "aho-corasick", "memchr", "regex-automata 0.4.5", "regex-syntax 0.8.2", @@ -4471,7 +4489,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ - "aho-corasick 1.0.3", + "aho-corasick", "memchr", "regex-syntax 0.8.2", ] @@ -5191,6 +5209,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04d2ecae5fcf33b122e2e6bd520a57ccf152d2dde3b38c71039df1a6867264ee" +[[package]] +name = "sketches-ddsketch" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85636c14b73d81f541e525f585c0a2109e6744e1565b5c1668e31c70c10ed65c" + [[package]] name = "slab" version = "0.4.8" diff --git a/Cargo.toml b/Cargo.toml index 41b65506b5a..cac859cf4b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,7 @@ napi = { version = "2.15.1", default-features = false, features = [ "serde-json", ] } napi-derive = "2.15.0" +metrics = "0.23.0" js-sys = { version = "0.3" } rand = { version = "0.8" } regex = { version = "1", features = ["std"] } diff --git a/quaint/Cargo.toml b/quaint/Cargo.toml index ff95dab0a87..f9e19627e13 100644 --- a/quaint/Cargo.toml +++ b/quaint/Cargo.toml @@ -76,7 +76,7 @@ tracing-core = "0.1" async-trait.workspace = true thiserror = "1.0" num_cpus = "1.12" -metrics = "0.18" +metrics.workspace = true futures = "0.3" url.workspace = true hex = "0.4" @@ -92,7 +92,7 @@ serde_json.workspace = true native-tls = { version = "0.2", optional = true } bit-vec = { version = "0.6.1", optional = true } bytes = { version = "1.0", optional = true } -mobc = { version = "0.8", optional = true } +mobc = { git="https://github.com/SevInf/mobc.git", branch = "metrics-guards", optional = true } serde = { version = "1.0" } sqlformat = { version = "0.2.3", optional = true } uuid.workspace = true diff --git a/quaint/src/connector/metrics.rs b/quaint/src/connector/metrics.rs index a0c4ef42698..2e2e4d18922 100644 --- a/quaint/src/connector/metrics.rs +++ b/quaint/src/connector/metrics.rs @@ -46,9 +46,9 @@ where trace_query(query, params, result, &start); } - histogram!(format!("{tag}.query.time"), start.elapsed_time()); - histogram!("prisma_datasource_queries_duration_histogram_ms", start.elapsed_time()); - increment_counter!("prisma_datasource_queries_total"); + histogram!(format!("{tag}.query.time")).record(start.elapsed_time()); + histogram!("prisma_datasource_queries_duration_histogram_ms").record(start.elapsed_time()); + counter!("prisma_datasource_queries_total").increment(1); res } @@ -74,7 +74,7 @@ where result, ); - histogram!("pool.check_out", start.elapsed_time()); + histogram!("pool.check_out").record(start.elapsed_time()); res } diff --git a/quaint/src/connector/transaction.rs b/quaint/src/connector/transaction.rs index df4084883e8..e0fd3cf6179 100644 --- a/quaint/src/connector/transaction.rs +++ b/quaint/src/connector/transaction.rs @@ -4,7 +4,7 @@ use crate::{ error::{Error, ErrorKind}, }; use async_trait::async_trait; -use metrics::{decrement_gauge, increment_gauge}; +use metrics::gauge; use std::{fmt, str::FromStr}; extern crate metrics as metrics; @@ -62,7 +62,7 @@ impl<'a> DefaultTransaction<'a> { inner.server_reset_query(&this).await?; - increment_gauge!("prisma_client_queries_active", 1.0); + gauge!("prisma_client_queries_active").increment(1.0); Ok(this) } } @@ -71,7 +71,7 @@ impl<'a> DefaultTransaction<'a> { impl<'a> Transaction for DefaultTransaction<'a> { /// Commit the changes to the database and consume the transaction. async fn commit(&self) -> crate::Result<()> { - decrement_gauge!("prisma_client_queries_active", 1.0); + gauge!("prisma_client_queries_active").decrement(1.0); self.inner.raw_cmd("COMMIT").await?; Ok(()) @@ -79,7 +79,7 @@ impl<'a> Transaction for DefaultTransaction<'a> { /// Rolls back the changes to the database. async fn rollback(&self) -> crate::Result<()> { - decrement_gauge!("prisma_client_queries_active", 1.0); + gauge!("prisma_client_queries_active").decrement(1.0); self.inner.raw_cmd("ROLLBACK").await?; Ok(()) diff --git a/query-engine/connectors/mongodb-query-connector/src/interface/transaction.rs b/query-engine/connectors/mongodb-query-connector/src/interface/transaction.rs index 2fe5d840fa1..41a5162dad7 100644 --- a/query-engine/connectors/mongodb-query-connector/src/interface/transaction.rs +++ b/query-engine/connectors/mongodb-query-connector/src/interface/transaction.rs @@ -5,7 +5,7 @@ use crate::{ }; use connector_interface::{ConnectionLike, ReadOperations, Transaction, UpdateType, WriteOperations}; use mongodb::options::{Acknowledgment, ReadConcern, TransactionOptions, WriteConcern}; -use query_engine_metrics::{decrement_gauge, increment_gauge, metrics, PRISMA_CLIENT_QUERIES_ACTIVE}; +use query_engine_metrics::{gauge, PRISMA_CLIENT_QUERIES_ACTIVE}; use query_structure::{RelationLoadStrategy, SelectionResult}; use std::collections::HashMap; @@ -31,7 +31,7 @@ impl<'conn> MongoDbTransaction<'conn> { .await .map_err(|err| MongoError::from(err).into_connector_error())?; - increment_gauge!(PRISMA_CLIENT_QUERIES_ACTIVE, 1.0); + gauge!(PRISMA_CLIENT_QUERIES_ACTIVE).increment(1.0); Ok(Self { connection }) } @@ -40,7 +40,7 @@ impl<'conn> MongoDbTransaction<'conn> { #[async_trait] impl<'conn> Transaction for MongoDbTransaction<'conn> { async fn commit(&mut self) -> connector_interface::Result<()> { - decrement_gauge!(PRISMA_CLIENT_QUERIES_ACTIVE, 1.0); + gauge!(PRISMA_CLIENT_QUERIES_ACTIVE).decrement(1.0); utils::commit_with_retry(&mut self.connection.session) .await @@ -50,7 +50,7 @@ impl<'conn> Transaction for MongoDbTransaction<'conn> { } async fn rollback(&mut self) -> connector_interface::Result<()> { - decrement_gauge!(PRISMA_CLIENT_QUERIES_ACTIVE, 1.0); + gauge!(PRISMA_CLIENT_QUERIES_ACTIVE).decrement(1.0); self.connection .session diff --git a/query-engine/connectors/mongodb-query-connector/src/root_queries/mod.rs b/query-engine/connectors/mongodb-query-connector/src/root_queries/mod.rs index 9ee217d62a8..1c25661b234 100644 --- a/query-engine/connectors/mongodb-query-connector/src/root_queries/mod.rs +++ b/query-engine/connectors/mongodb-query-connector/src/root_queries/mod.rs @@ -14,8 +14,7 @@ use bson::Bson; use bson::Document; use futures::Future; use query_engine_metrics::{ - histogram, increment_counter, metrics, PRISMA_DATASOURCE_QUERIES_DURATION_HISTOGRAM_MS, - PRISMA_DATASOURCE_QUERIES_TOTAL, + counter, histogram, PRISMA_DATASOURCE_QUERIES_DURATION_HISTOGRAM_MS, PRISMA_DATASOURCE_QUERIES_TOTAL, }; use query_structure::*; use std::sync::Arc; @@ -76,8 +75,8 @@ where let res = f().instrument(span).await; let elapsed = start.elapsed().as_millis() as f64; - histogram!(PRISMA_DATASOURCE_QUERIES_DURATION_HISTOGRAM_MS, elapsed); - increment_counter!(PRISMA_DATASOURCE_QUERIES_TOTAL); + histogram!(PRISMA_DATASOURCE_QUERIES_DURATION_HISTOGRAM_MS).record(elapsed); + counter!(PRISMA_DATASOURCE_QUERIES_TOTAL).increment(1); // TODO prisma/team-orm#136: fix log subscription. // NOTE: `params` is a part of the interface for query logs. diff --git a/query-engine/core/src/executor/execute_operation.rs b/query-engine/core/src/executor/execute_operation.rs index 6ef445d8364..7621a17a1d6 100644 --- a/query-engine/core/src/executor/execute_operation.rs +++ b/query-engine/core/src/executor/execute_operation.rs @@ -12,7 +12,7 @@ use futures::future; #[cfg(feature = "metrics")] use query_engine_metrics::{ - histogram, increment_counter, metrics, PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS, PRISMA_CLIENT_QUERIES_TOTAL, + counter, histogram, PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS, PRISMA_CLIENT_QUERIES_TOTAL, }; use schema::{QuerySchema, QuerySchemaRef}; @@ -32,10 +32,7 @@ pub async fn execute_single_operation( let result = execute_on(conn, graph, serializer, query_schema.as_ref(), trace_id).await; #[cfg(feature = "metrics")] - histogram!( - PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS, - operation_timer.elapsed_time() - ); + histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS,).record(operation_timer.elapsed_time()); result } @@ -58,10 +55,7 @@ pub async fn execute_many_operations( let result = execute_on(conn, graph, serializer, query_schema.as_ref(), trace_id.clone()).await; #[cfg(feature = "metrics")] - histogram!( - PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS, - operation_timer.elapsed_time() - ); + histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS,).record(operation_timer.elapsed_time()); match result { Ok(result) => results.push(Ok(result)), @@ -115,7 +109,7 @@ pub async fn execute_many_self_contained( let dispatcher = crate::get_current_dispatcher(); for op in operations { #[cfg(feature = "metrics")] - increment_counter!(PRISMA_CLIENT_QUERIES_TOTAL); + counter!(PRISMA_CLIENT_QUERIES_TOTAL).increment(1); let conn_span = info_span!( "prisma:engine:connection", @@ -176,10 +170,7 @@ async fn execute_self_contained( }; #[cfg(feature = "metrics")] - histogram!( - PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS, - operation_timer.elapsed_time() - ); + histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS,).record(operation_timer.elapsed_time()); result } @@ -281,7 +272,7 @@ async fn execute_on<'a>( trace_id: Option, ) -> crate::Result { #[cfg(feature = "metrics")] - increment_counter!(PRISMA_CLIENT_QUERIES_TOTAL); + counter!(PRISMA_CLIENT_QUERIES_TOTAL).increment(1); let interpreter = QueryInterpreter::new(conn); QueryPipeline::new(graph, interpreter, serializer) diff --git a/query-engine/driver-adapters/Cargo.toml b/query-engine/driver-adapters/Cargo.toml index 39a0314a476..767780ff65d 100644 --- a/query-engine/driver-adapters/Cargo.toml +++ b/query-engine/driver-adapters/Cargo.toml @@ -15,7 +15,7 @@ serde.workspace = true serde_json.workspace = true tracing.workspace = true tracing-core = "0.1" -metrics = "0.18" +metrics.workspace = true uuid.workspace = true pin-project = "1" serde_repr.workspace = true diff --git a/query-engine/driver-adapters/src/proxy.rs b/query-engine/driver-adapters/src/proxy.rs index 1c2a5a68240..65447c0b95e 100644 --- a/query-engine/driver-adapters/src/proxy.rs +++ b/query-engine/driver-adapters/src/proxy.rs @@ -7,7 +7,7 @@ use crate::{ use crate::{send_future::UnsafeFuture, transaction::JsTransactionContext}; use futures::Future; -use metrics::increment_gauge; +use metrics::gauge; use std::sync::atomic::{AtomicBool, Ordering}; /// Proxy is a struct wrapping a javascript object that exhibits basic primitives for @@ -121,7 +121,7 @@ impl TransactionContextProxy { // Previously, it was done in JsTransaction::new, similar to the native Transaction. // However, correct Dispatcher is lost there and increment does not register, so we moved // it here instead. - increment_gauge!("prisma_client_queries_active", 1.0); + gauge!("prisma_client_queries_active").increment(1.0); Ok(Box::new(tx)) } diff --git a/query-engine/driver-adapters/src/transaction.rs b/query-engine/driver-adapters/src/transaction.rs index 8d124bd4da0..1578eaf3220 100644 --- a/query-engine/driver-adapters/src/transaction.rs +++ b/query-engine/driver-adapters/src/transaction.rs @@ -1,7 +1,7 @@ use std::future::Future; use async_trait::async_trait; -use metrics::decrement_gauge; +use metrics::gauge; use quaint::{ connector::{DescribedQuery, IsolationLevel, Transaction as QuaintTransaction}, prelude::{Query as QuaintQuery, Queryable, ResultSet}, @@ -107,7 +107,7 @@ impl JsTransaction { impl QuaintTransaction for JsTransaction { async fn commit(&self) -> quaint::Result<()> { // increment of this gauge is done in DriverProxy::startTransaction - decrement_gauge!("prisma_client_queries_active", 1.0); + gauge!("prisma_client_queries_active").decrement(1.0); let commit_stmt = "COMMIT"; @@ -123,7 +123,7 @@ impl QuaintTransaction for JsTransaction { async fn rollback(&self) -> quaint::Result<()> { // increment of this gauge is done in DriverProxy::startTransaction - decrement_gauge!("prisma_client_queries_active", 1.0); + gauge!("prisma_client_queries_active").decrement(1.0); let rollback_stmt = "ROLLBACK"; diff --git a/query-engine/metrics/Cargo.toml b/query-engine/metrics/Cargo.toml index 5593b246c09..10e64c7bb9e 100644 --- a/query-engine/metrics/Cargo.toml +++ b/query-engine/metrics/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -metrics = "0.18" -metrics-util = "0.12.1" +metrics.workspace = true +metrics-util = "0.17.0" metrics-exporter-prometheus = "0.10.0" once_cell = "1.3" serde.workspace = true diff --git a/query-engine/metrics/src/lib.rs b/query-engine/metrics/src/lib.rs index 1965b56cb07..8b6e5d41bfd 100644 --- a/query-engine/metrics/src/lib.rs +++ b/query-engine/metrics/src/lib.rs @@ -38,10 +38,7 @@ use std::collections::HashMap; use std::sync::Once; pub extern crate metrics; -pub use metrics::{ - absolute_counter, decrement_gauge, describe_counter, describe_gauge, describe_histogram, gauge, histogram, - increment_counter, increment_gauge, -}; +pub use metrics::{describe_counter, describe_gauge, describe_histogram, gauge, histogram, counter}; // Metrics that we emit from the engines, third party metrics emitted by libraries and that we rename are omitted. pub const PRISMA_CLIENT_QUERIES_TOTAL: &str = "prisma_client_queries_total"; // counter @@ -102,9 +99,7 @@ pub fn setup() { static METRIC_RECORDER: Once = Once::new(); fn set_recorder() { - METRIC_RECORDER.call_once(|| { - metrics::set_boxed_recorder(Box::new(MetricRecorder)).unwrap(); - }); + METRIC_RECORDER.call_once(|| metrics::set_global_recorder(MetricRecorder).unwrap()); } /// Initialize metrics descriptions and values @@ -145,15 +140,15 @@ fn initialize_metrics_descriptions() { /// Histograms are excluded, as their initialization will alter the histogram values. /// (i.e. histograms don't have a neutral value, like counters or gauges) fn initialize_metrics_values() { - absolute_counter!(PRISMA_CLIENT_QUERIES_TOTAL, 0); - absolute_counter!(PRISMA_DATASOURCE_QUERIES_TOTAL, 0); - gauge!(PRISMA_CLIENT_QUERIES_ACTIVE, 0.0); - absolute_counter!(MOBC_POOL_CONNECTIONS_OPENED_TOTAL, 0); - absolute_counter!(MOBC_POOL_CONNECTIONS_CLOSED_TOTAL, 0); - gauge!(MOBC_POOL_CONNECTIONS_OPEN, 0.0); - gauge!(MOBC_POOL_CONNECTIONS_BUSY, 0.0); - gauge!(MOBC_POOL_CONNECTIONS_IDLE, 0.0); - gauge!(MOBC_POOL_WAIT_COUNT, 0.0); + counter!(PRISMA_CLIENT_QUERIES_TOTAL).absolute(0); + counter!(PRISMA_DATASOURCE_QUERIES_TOTAL).absolute(0); + gauge!(PRISMA_CLIENT_QUERIES_ACTIVE).set(0.0); + counter!(MOBC_POOL_CONNECTIONS_OPENED_TOTAL).absolute(0); + counter!(MOBC_POOL_CONNECTIONS_CLOSED_TOTAL).absolute(0); + gauge!(MOBC_POOL_CONNECTIONS_OPEN).set(0.0); + gauge!(MOBC_POOL_CONNECTIONS_BUSY).set(0.0); + gauge!(MOBC_POOL_CONNECTIONS_IDLE).set(0.0); + gauge!(MOBC_POOL_WAIT_COUNT).set(0.0); } // At the moment the histogram is only used for timings. So the bounds are hard coded here @@ -171,10 +166,7 @@ pub enum MetricFormat { #[cfg(test)] mod tests { use super::*; - use metrics::{ - absolute_counter, decrement_gauge, describe_counter, describe_gauge, describe_histogram, gauge, histogram, - increment_counter, increment_gauge, register_counter, register_gauge, register_histogram, - }; + use metrics::{describe_counter, describe_gauge, describe_histogram, gauge, histogram}; use serde_json::json; use std::collections::HashMap; use std::time::Duration; @@ -211,12 +203,12 @@ mod tests { let metrics = MetricRegistry::new_with_accept_list(TESTING_ACCEPT_LIST.to_vec()); let dispatch = Dispatch::new(tracing_subscriber::Registry::default().with(metrics.clone())); async { - let counter1 = register_counter!("test_counter"); + let counter1 = counter!("test_counter"); counter1.increment(1); - increment_counter!("test_counter"); - increment_counter!("test_counter"); + counter!("test_counter").increment(1); + counter!("test_counter").increment(1); - increment_counter!("another_counter"); + counter!("another_counter").increment(1); let val = metrics.counter_value("test_counter").unwrap(); assert_eq!(val, 3); @@ -224,7 +216,7 @@ mod tests { let val2 = metrics.counter_value("another_counter").unwrap(); assert_eq!(val2, 1); - absolute_counter!("test_counter", 5); + counter!("test_counter").absolute(5); let val3 = metrics.counter_value("test_counter").unwrap(); assert_eq!(val3, 5); } @@ -239,11 +231,11 @@ mod tests { let metrics = MetricRegistry::new_with_accept_list(TESTING_ACCEPT_LIST.to_vec()); let dispatch = Dispatch::new(tracing_subscriber::Registry::default().with(metrics.clone())); async { - let gauge1 = register_gauge!("test_gauge"); + let gauge1 = gauge!("test_gauge"); gauge1.increment(1.0); - increment_gauge!("test_gauge", 1.0); - increment_gauge!("test_gauge", 1.0); - increment_gauge!("another_gauge", 1.0); + gauge!("test_gauge").increment(1.0); + gauge!("test_gauge").increment(1.0); + gauge!("another_gauge").increment(1.0); let val = metrics.gauge_value("test_gauge").unwrap(); assert_eq!(val, 3.0); @@ -253,11 +245,11 @@ mod tests { assert_eq!(None, metrics.counter_value("test_gauge")); - gauge!("test_gauge", 5.0); + gauge!("test_gauge").set(5.0); let val3 = metrics.gauge_value("test_gauge").unwrap(); assert_eq!(val3, 5.0); - decrement_gauge!("test_gauge", 2.0); + gauge!("test_gauge").decrement(2.0); let val4 = metrics.gauge_value("test_gauge").unwrap(); assert_eq!(val4, 3.0); } @@ -274,8 +266,8 @@ mod tests { async { trace!("a fake trace"); - increment_gauge!("test_gauge", 1.0); - increment_counter!("test_counter"); + gauge!("test_gauge").set(1.0); + counter!("test_counter").increment(1); trace!("another fake trace"); @@ -293,8 +285,8 @@ mod tests { let metrics = MetricRegistry::new_with_accept_list(TESTING_ACCEPT_LIST.to_vec()); let dispatch = Dispatch::new(tracing_subscriber::Registry::default().with(metrics.clone())); async { - increment_gauge!("not_accepted", 1.0); - increment_gauge!("test_gauge", 1.0); + gauge!("not_accepted").set(1.0); + gauge!("test_gauge").set(1.0); assert_eq!(1.0, metrics.gauge_value("test_gauge").unwrap()); assert_eq!(None, metrics.gauge_value("not_accepted")); @@ -310,15 +302,15 @@ mod tests { let metrics = MetricRegistry::new_with_accept_list(TESTING_ACCEPT_LIST.to_vec()); let dispatch = Dispatch::new(tracing_subscriber::Registry::default().with(metrics.clone())); async { - let hist = register_histogram!("test_histogram"); + let hist = histogram!("test_histogram"); hist.record(Duration::from_millis(9)); - histogram!("test_histogram", Duration::from_millis(100)); - histogram!("test_histogram", Duration::from_millis(1)); + histogram!("test_histogram").record(Duration::from_millis(100)); + histogram!("test_histogram").record(Duration::from_millis(1)); - histogram!("test_histogram", Duration::from_millis(1999)); - histogram!("test_histogram", Duration::from_millis(3999)); - histogram!("test_histogram", Duration::from_millis(610)); + histogram!("test_histogram").record(Duration::from_millis(1999)); + histogram!("test_histogram").record(Duration::from_millis(3999)); + histogram!("test_histogram").record(Duration::from_millis(610)); let hist = metrics.histogram_values("test_histogram").unwrap(); let expected: Vec<(f64, u64)> = Vec::from([ @@ -386,21 +378,21 @@ mod tests { assert_eq!(metrics.to_json(Default::default()), empty); - absolute_counter!("counter_1", 4, "label" => "one"); + counter!("counter_1", "label" => "one").absolute(4); describe_counter!("counter_2", "this is a description for counter 2"); - absolute_counter!("counter_2", 2, "label" => "one", "another_label" => "two"); + counter!("counter_2", "label" => "one", "another_label" => "two").absolute(2); describe_gauge!("gauge_1", "a description for gauge 1"); - gauge!("gauge_1", 7.0); - gauge!("gauge_2", 3.0, "label" => "three"); + gauge!("gauge_1").set(7.0); + gauge!("gauge_2", "label" => "three").set(3.0); describe_histogram!("histogram_1", "a description for histogram"); - let hist = register_histogram!("histogram_1", "label" => "one", "hist_two" => "two"); + let hist = histogram!("histogram_1", "label" => "one", "hist_two" => "two"); hist.record(Duration::from_millis(9)); - histogram!("histogram_2", Duration::from_millis(9)); - histogram!("histogram_2", Duration::from_millis(1000)); - histogram!("histogram_2", Duration::from_millis(40)); + histogram!("histogram_2").record(Duration::from_millis(9)); + histogram!("histogram_2").record(Duration::from_millis(1000)); + histogram!("histogram_2").record(Duration::from_millis(40)); let json = metrics.to_json(Default::default()); let expected = json!({ @@ -459,10 +451,10 @@ mod tests { let metrics = MetricRegistry::new_with_accept_list(TESTING_ACCEPT_LIST.to_vec()); let dispatch = Dispatch::new(tracing_subscriber::Registry::default().with(metrics.clone())); async { - let hist = register_histogram!("test_histogram", "label" => "one", "two" => "another"); + let hist = histogram!("test_histogram", "label" => "one", "two" => "another"); hist.record(Duration::from_millis(9)); - absolute_counter!("counter_1", 1); + counter!("counter_1").absolute(1); let mut global_labels: HashMap = HashMap::new(); global_labels.insert("global_one".to_string(), "one".to_string()); @@ -502,19 +494,19 @@ mod tests { let metrics = MetricRegistry::new_with_accept_list(TESTING_ACCEPT_LIST.to_vec()); let dispatch = Dispatch::new(tracing_subscriber::Registry::default().with(metrics.clone())); async { - absolute_counter!("counter_1", 4, "label" => "one"); + counter!("counter_1", "label" => "one").absolute(4); describe_counter!("counter_2", "this is a description for counter 2"); - absolute_counter!("counter_2", 2, "label" => "one", "another_label" => "two"); + counter!("counter_2", "label" => "one", "another_label" => "two").absolute(2); describe_gauge!("gauge_1", "a description for gauge 1"); - gauge!("gauge_1", 7.0); - gauge!("gauge_2", 3.0, "label" => "three"); + gauge!("gauge_1").set(7.0); + gauge!("gauge_2", "label" => "three").set(3.0); describe_histogram!("histogram_1", "a description for histogram"); - let hist = register_histogram!("histogram_1", "label" => "one", "hist_two" => "two"); + let hist = histogram!("histogram_1", "label" => "one", "hist_two" => "two"); hist.record(Duration::from_millis(9)); - histogram!("histogram_2", Duration::from_millis(1000)); + histogram!("histogram_2").record(Duration::from_millis(1000)); let mut global_labels: HashMap = HashMap::new(); global_labels.insert("global_two".to_string(), "two".to_string()); diff --git a/query-engine/metrics/src/recorder.rs b/query-engine/metrics/src/recorder.rs index 94d2c050f60..0d3ae8ecf22 100644 --- a/query-engine/metrics/src/recorder.rs +++ b/query-engine/metrics/src/recorder.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use metrics::KeyName; +use metrics::{KeyName, Metadata, SharedString}; use metrics::{Counter, CounterFn, Gauge, GaugeFn, Histogram, HistogramFn, Key, Recorder, Unit}; use tracing::trace; @@ -22,27 +22,27 @@ impl MetricRecorder { } impl Recorder for MetricRecorder { - fn describe_counter(&self, key_name: KeyName, _unit: Option, description: &'static str) { - self.register_description(key_name.as_str(), description); + fn describe_counter(&self, key_name: KeyName, _unit: Option, description: SharedString) { + self.register_description(key_name.as_str(), &description); } - fn describe_gauge(&self, key_name: KeyName, _unit: Option, description: &'static str) { - self.register_description(key_name.as_str(), description); + fn describe_gauge(&self, key_name: KeyName, _unit: Option, description: SharedString) { + self.register_description(key_name.as_str(), &description); } - fn describe_histogram(&self, key_name: KeyName, _unit: Option, description: &'static str) { - self.register_description(key_name.as_str(), description); + fn describe_histogram(&self, key_name: KeyName, _unit: Option, description: SharedString) { + self.register_description(key_name.as_str(), &description); } - fn register_counter(&self, key: &Key) -> Counter { + fn register_counter(&self, key: &Key, _metadata: &Metadata<'_>) -> Counter { Counter::from_arc(Arc::new(MetricHandle(key.clone()))) } - fn register_gauge(&self, key: &Key) -> Gauge { + fn register_gauge(&self, key: &Key, _metadata: &Metadata<'_>) -> Gauge { Gauge::from_arc(Arc::new(MetricHandle(key.clone()))) } - fn register_histogram(&self, key: &Key) -> Histogram { + fn register_histogram(&self, key: &Key, _metadata: &Metadata<'_>) -> Histogram { Histogram::from_arc(Arc::new(MetricHandle(key.clone()))) } } From 6a8d01509a29fc29555d9d396d48f61d91c43b62 Mon Sep 17 00:00:00 2001 From: Serhii Tatarintsev Date: Thu, 10 Oct 2024 18:50:53 +0200 Subject: [PATCH 2/9] Fix trailing commas --- query-engine/core/src/executor/execute_operation.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/query-engine/core/src/executor/execute_operation.rs b/query-engine/core/src/executor/execute_operation.rs index 7621a17a1d6..b68979f1335 100644 --- a/query-engine/core/src/executor/execute_operation.rs +++ b/query-engine/core/src/executor/execute_operation.rs @@ -32,7 +32,7 @@ pub async fn execute_single_operation( let result = execute_on(conn, graph, serializer, query_schema.as_ref(), trace_id).await; #[cfg(feature = "metrics")] - histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS,).record(operation_timer.elapsed_time()); + histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS).record(operation_timer.elapsed_time()); result } @@ -55,7 +55,7 @@ pub async fn execute_many_operations( let result = execute_on(conn, graph, serializer, query_schema.as_ref(), trace_id.clone()).await; #[cfg(feature = "metrics")] - histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS,).record(operation_timer.elapsed_time()); + histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS).record(operation_timer.elapsed_time()); match result { Ok(result) => results.push(Ok(result)), @@ -170,7 +170,7 @@ async fn execute_self_contained( }; #[cfg(feature = "metrics")] - histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS,).record(operation_timer.elapsed_time()); + histogram!(PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS).record(operation_timer.elapsed_time()); result } From 7810612a16503d9160142d3d7a55680f41c2b5da Mon Sep 17 00:00:00 2001 From: Serhii Tatarintsev Date: Wed, 16 Oct 2024 10:53:33 +0200 Subject: [PATCH 3/9] Update --- Cargo.lock | 4 ++-- quaint/Cargo.toml | 2 +- query-engine/metrics/src/lib.rs | 2 +- query-engine/metrics/src/recorder.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c0d80fa7557..37cea73e137 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2609,8 +2609,8 @@ dependencies = [ [[package]] name = "mobc" -version = "0.8.4" -source = "git+https://github.com/SevInf/mobc.git?branch=metrics-guards#da80095bc4e6777991f5e20328008e91f1c03573" +version = "0.8.5" +source = "git+https://github.com/importcjj/mobc.git?branch=main#4c05a47515623b5b6afbbb280ac8153089b6775e" dependencies = [ "async-trait", "futures-channel", diff --git a/quaint/Cargo.toml b/quaint/Cargo.toml index f9e19627e13..73c384bab15 100644 --- a/quaint/Cargo.toml +++ b/quaint/Cargo.toml @@ -92,7 +92,7 @@ serde_json.workspace = true native-tls = { version = "0.2", optional = true } bit-vec = { version = "0.6.1", optional = true } bytes = { version = "1.0", optional = true } -mobc = { git="https://github.com/SevInf/mobc.git", branch = "metrics-guards", optional = true } +mobc = { git="https://github.com/importcjj/mobc.git", branch = "main", optional = true } serde = { version = "1.0" } sqlformat = { version = "0.2.3", optional = true } uuid.workspace = true diff --git a/query-engine/metrics/src/lib.rs b/query-engine/metrics/src/lib.rs index 8b6e5d41bfd..9a041102c4b 100644 --- a/query-engine/metrics/src/lib.rs +++ b/query-engine/metrics/src/lib.rs @@ -38,7 +38,7 @@ use std::collections::HashMap; use std::sync::Once; pub extern crate metrics; -pub use metrics::{describe_counter, describe_gauge, describe_histogram, gauge, histogram, counter}; +pub use metrics::{counter, describe_counter, describe_gauge, describe_histogram, gauge, histogram}; // Metrics that we emit from the engines, third party metrics emitted by libraries and that we rename are omitted. pub const PRISMA_CLIENT_QUERIES_TOTAL: &str = "prisma_client_queries_total"; // counter diff --git a/query-engine/metrics/src/recorder.rs b/query-engine/metrics/src/recorder.rs index 0d3ae8ecf22..25a71967f6a 100644 --- a/query-engine/metrics/src/recorder.rs +++ b/query-engine/metrics/src/recorder.rs @@ -1,7 +1,7 @@ use std::sync::Arc; -use metrics::{KeyName, Metadata, SharedString}; use metrics::{Counter, CounterFn, Gauge, GaugeFn, Histogram, HistogramFn, Key, Recorder, Unit}; +use metrics::{KeyName, Metadata, SharedString}; use tracing::trace; use super::common::KeyLabels; From 9b37e2bd17ea368428fed42b89cd8e9585a30759 Mon Sep 17 00:00:00 2001 From: Serhii Tatarintsev Date: Wed, 16 Oct 2024 12:20:47 +0200 Subject: [PATCH 4/9] Update prometheus exporter --- Cargo.lock | 508 ++++++++++++++++++++------------ query-engine/metrics/Cargo.toml | 2 +- 2 files changed, 318 insertions(+), 192 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 37cea73e137..46c9efcfca8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -206,13 +206,10 @@ dependencies = [ ] [[package]] -name = "atomic-shim" -version = "0.2.0" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cd4b51d303cf3501c301e8125df442128d3c6d7c69f71b27833d253de47e77" -dependencies = [ - "crossbeam-utils", -] +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "atty" @@ -231,6 +228,33 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "aws-lc-rs" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd82dba44d209fddb11c190e0a94b78651f95299598e472215667417a03ff1d" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df7a4168111d7eb622a31b214057b8509c0a7e1794f44c546d742330dc793972" +dependencies = [ + "bindgen 0.69.5", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "backtrace" version = "0.3.68" @@ -321,6 +345,29 @@ dependencies = [ "shlex", ] +[[package]] +name = "bindgen" +version = "0.69.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +dependencies = [ + "bitflags 2.4.0", + "cexpr", + "clang-sys", + "itertools 0.12.0", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.58", + "which", +] + [[package]] name = "bit-vec" version = "0.6.3" @@ -503,9 +550,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cast" @@ -534,11 +581,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ + "jobserver", "libc", + "shlex", ] [[package]] @@ -1092,7 +1141,7 @@ dependencies = [ "hashbrown 0.14.5", "lock_api", "once_cell", - "parking_lot_core 0.9.8", + "parking_lot_core", ] [[package]] @@ -1217,7 +1266,7 @@ dependencies = [ "expect-test", "futures", "js-sys", - "metrics 0.23.0", + "metrics", "napi", "napi-derive", "once_cell", @@ -1237,6 +1286,12 @@ dependencies = [ "wasm-rs-dbg", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "either" version = "1.9.0" @@ -1560,6 +1615,12 @@ dependencies = [ "syn 2.0.58", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -1622,7 +1683,7 @@ checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -1767,19 +1828,29 @@ dependencies = [ ] [[package]] -name = "half" -version = "1.8.2" +name = "h2" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.2.2", + "slab", + "tokio", + "tokio-util 0.7.8", + "tracing", +] [[package]] -name = "hashbrown" -version = "0.11.2" +name = "half" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.8", -] +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" @@ -1881,7 +1952,7 @@ dependencies = [ "ipconfig", "lru-cache", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "rand 0.8.5", "resolv-conf", "smallvec", @@ -1952,6 +2023,29 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.8.0" @@ -1974,9 +2068,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.9", - "http-body", + "http-body 0.4.5", "httparse", "httpdate", "itoa", @@ -1988,13 +2082,53 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +dependencies = [ + "futures-util", + "http 1.1.0", + "hyper 1.5.0", + "hyper-util", + "log", + "rustls 0.23.14", + "rustls-native-certs 0.8.0", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.0", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.27", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -2007,12 +2141,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.27", "native-tls", "tokio", "tokio-native-tls", ] +[[package]] +name = "hyper-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.5.0", + "pin-project-lite", + "socket2 0.5.7", + "tokio", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.57" @@ -2129,15 +2282,6 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - [[package]] name = "ipconfig" version = "0.3.2" @@ -2191,6 +2335,15 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.65" @@ -2435,15 +2588,6 @@ dependencies = [ "url", ] -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - [[package]] name = "match_cfg" version = "0.1.0" @@ -2489,16 +2633,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "metrics" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142c53885123b68d94108295a09d4afe1a1388ed95b54d5dacd9a454753030f2" -dependencies = [ - "ahash 0.7.8", - "metrics-macros", -] - [[package]] name = "metrics" version = "0.23.0" @@ -2511,50 +2645,25 @@ dependencies = [ [[package]] name = "metrics-exporter-prometheus" -version = "0.10.0" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953cbbb6f9ba4b9304f4df79b98cdc9d14071ed93065a9fca11c00c5d9181b66" +checksum = "b4f0c8427b39666bf970460908b213ec09b3b350f20c0c2eabcbba51704a08e6" dependencies = [ - "hyper", - "indexmap 1.9.3", + "base64 0.22.1", + "http-body-util", + "hyper 1.5.0", + "hyper-rustls", + "hyper-util", + "indexmap 2.2.2", "ipnet", - "metrics 0.19.0", - "metrics-util 0.13.0", - "parking_lot 0.11.2", - "quanta 0.9.3", + "metrics", + "metrics-util", + "quanta", "thiserror", "tokio", "tracing", ] -[[package]] -name = "metrics-macros" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49e30813093f757be5cf21e50389a24dc7dbb22c49f23b7e8f51d69b508a5ffa" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "metrics-util" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1f4b69bef1e2b392b2d4a12902f2af90bb438ba4a66aa222d1023fa6561b50" -dependencies = [ - "atomic-shim", - "crossbeam-epoch", - "crossbeam-utils", - "hashbrown 0.11.2", - "metrics 0.19.0", - "num_cpus", - "parking_lot 0.11.2", - "quanta 0.9.3", - "sketches-ddsketch 0.1.3", -] - [[package]] name = "metrics-util" version = "0.17.0" @@ -2566,12 +2675,12 @@ dependencies = [ "crossbeam-utils", "hashbrown 0.14.5", "indexmap 2.2.2", - "metrics 0.23.0", + "metrics", "num_cpus", "ordered-float", - "quanta 0.12.3", + "quanta", "radix_trie", - "sketches-ddsketch 0.2.2", + "sketches-ddsketch", ] [[package]] @@ -2607,6 +2716,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "mobc" version = "0.8.5" @@ -2618,7 +2733,7 @@ dependencies = [ "futures-timer", "futures-util", "log", - "metrics 0.23.0", + "metrics", "thiserror", "tokio", "tracing", @@ -2653,7 +2768,7 @@ dependencies = [ "rand 0.8.5", "rustc_version_runtime", "rustls 0.21.10", - "rustls-pemfile", + "rustls-pemfile 1.0.3", "serde", "serde_bytes", "serde_with", @@ -2813,7 +2928,7 @@ checksum = "9006c95034ccf7b903d955f210469119f6c3477fc9c9e7a7845ce38a3e665c2a" dependencies = [ "base64 0.13.1", "bigdecimal", - "bindgen", + "bindgen 0.59.2", "bitflags 1.3.2", "bitvec", "byteorder", @@ -3236,17 +3351,6 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -3254,21 +3358,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -3279,7 +3369,7 @@ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", "windows-targets 0.48.1", ] @@ -3580,6 +3670,16 @@ dependencies = [ "yansi", ] +[[package]] +name = "prettyplease" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" +dependencies = [ + "proc-macro2", + "syn 2.0.58", +] + [[package]] name = "priority-queue" version = "1.3.2" @@ -3836,7 +3936,7 @@ dependencies = [ "indoc 0.3.6", "itertools 0.12.0", "lru-cache", - "metrics 0.23.0", + "metrics", "mobc", "mysql_async", "names 0.11.0", @@ -3890,22 +3990,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "quanta" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8" -dependencies = [ - "crossbeam-utils", - "libc", - "mach", - "once_cell", - "raw-cpuid 10.7.0", - "wasi 0.10.2+wasi-snapshot-preview1", - "web-sys", - "winapi", -] - [[package]] name = "quanta" version = "0.12.3" @@ -3915,7 +3999,7 @@ dependencies = [ "crossbeam-utils", "libc", "once_cell", - "raw-cpuid 11.2.0", + "raw-cpuid", "wasi 0.11.0+wasi-snapshot-preview1", "web-sys", "winapi", @@ -3987,7 +4071,7 @@ dependencies = [ "connection-string", "enumflags2", "graphql-parser", - "hyper", + "hyper 0.14.27", "indoc 2.0.3", "mongodb-query-connector", "opentelemetry", @@ -4078,11 +4162,11 @@ name = "query-engine-metrics" version = "0.1.0" dependencies = [ "expect-test", - "metrics 0.23.0", + "metrics", "metrics-exporter-prometheus", - "metrics-util 0.17.0", + "metrics-util", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "serde", "serde_json", "tokio", @@ -4224,7 +4308,7 @@ dependencies = [ "async-trait", "colored", "enumflags2", - "hyper", + "hyper 0.14.27", "indexmap 2.2.2", "indoc 2.0.3", "insta", @@ -4395,15 +4479,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "raw-cpuid" -version = "10.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "raw-cpuid" version = "11.2.0" @@ -4444,15 +4519,6 @@ dependencies = [ "rand_core 0.3.1", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -4556,10 +4622,10 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.9", - "http-body", - "hyper", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-tls", "ipnet", "js-sys", @@ -4746,10 +4812,25 @@ checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring 0.17.7", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct 0.7.0", ] +[[package]] +name = "rustls" +version = "0.23.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.102.8", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" version = "0.5.0" @@ -4762,6 +4843,19 @@ dependencies = [ "security-framework", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.2.0", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "1.0.3" @@ -4771,6 +4865,21 @@ dependencies = [ "base64 0.21.2", ] +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -4781,6 +4890,18 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "aws-lc-rs", + "ring 0.17.7", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "ryu" version = "1.0.15" @@ -5087,7 +5208,7 @@ dependencies = [ "futures", "lazy_static", "log", - "parking_lot 0.12.1", + "parking_lot", "serial_test_derive", ] @@ -5203,12 +5324,6 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" -[[package]] -name = "sketches-ddsketch" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04d2ecae5fcf33b122e2e6bd520a57ccf152d2dde3b38c71039df1a6867264ee" - [[package]] name = "sketches-ddsketch" version = "0.2.2" @@ -5226,9 +5341,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -5640,7 +5755,7 @@ checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall", "rustix", "windows-sys 0.48.0", ] @@ -5844,7 +5959,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2 0.5.7", @@ -5895,7 +6010,7 @@ dependencies = [ "futures-channel", "futures-util", "log", - "parking_lot 0.12.1", + "parking_lot", "percent-encoding", "phf", "pin-project-lite", @@ -5927,6 +6042,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.14", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.14" @@ -5988,16 +6114,16 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "h2", + "h2 0.3.26", "http 0.2.9", - "http-body", - "hyper", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-timeout", "percent-encoding", "pin-project", "prost", "prost-derive", - "rustls-native-certs", + "rustls-native-certs 0.5.0", "tokio", "tokio-rustls 0.22.0", "tokio-stream", @@ -6470,12 +6596,6 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -6945,3 +7065,9 @@ dependencies = [ "quote", "syn 2.0.58", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/query-engine/metrics/Cargo.toml b/query-engine/metrics/Cargo.toml index 10e64c7bb9e..2bbb883dd8e 100644 --- a/query-engine/metrics/Cargo.toml +++ b/query-engine/metrics/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] metrics.workspace = true metrics-util = "0.17.0" -metrics-exporter-prometheus = "0.10.0" +metrics-exporter-prometheus = "0.15.3" once_cell = "1.3" serde.workspace = true serde_json.workspace = true From f5a8bddf0da15125e56beaa4ecaebe2a8fa721b9 Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Mon, 21 Oct 2024 12:04:02 +0200 Subject: [PATCH 5/9] Switch to published mobc --- Cargo.lock | 3 ++- quaint/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 46c9efcfca8..83723a2d23a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2725,7 +2725,8 @@ checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" [[package]] name = "mobc" version = "0.8.5" -source = "git+https://github.com/importcjj/mobc.git?branch=main#4c05a47515623b5b6afbbb280ac8153089b6775e" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "316a7d198b51958a0ab57248bf5f42d8409551203cb3c821d5925819a8d5415f" dependencies = [ "async-trait", "futures-channel", diff --git a/quaint/Cargo.toml b/quaint/Cargo.toml index 73c384bab15..cfac06e101d 100644 --- a/quaint/Cargo.toml +++ b/quaint/Cargo.toml @@ -92,7 +92,7 @@ serde_json.workspace = true native-tls = { version = "0.2", optional = true } bit-vec = { version = "0.6.1", optional = true } bytes = { version = "1.0", optional = true } -mobc = { git="https://github.com/importcjj/mobc.git", branch = "main", optional = true } +mobc = { version = "0.8.5", optional = true } serde = { version = "1.0" } sqlformat = { version = "0.2.3", optional = true } uuid.workspace = true From b83d79f661e0d7de075cb5932c047c662ff6a404 Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Mon, 21 Oct 2024 12:18:10 +0200 Subject: [PATCH 6/9] Install bindgen to build newer rustls on react-native --- .../build-engines-react-native-template.yml | 4 ++++ .../workflows/include/bindgen-setup/action.yml | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 .github/workflows/include/bindgen-setup/action.yml diff --git a/.github/workflows/build-engines-react-native-template.yml b/.github/workflows/build-engines-react-native-template.yml index 09cf6f6858b..89dbdb3be56 100644 --- a/.github/workflows/build-engines-react-native-template.yml +++ b/.github/workflows/build-engines-react-native-template.yml @@ -26,6 +26,8 @@ jobs: with: ref: ${{ inputs.commit }} + - uses: ./.github/workflows/include/bindgen-setup + - uses: actions/cache@v4 with: path: | @@ -69,6 +71,8 @@ jobs: with: ref: ${{ inputs.commit }} + - uses: ./.github/workflows/include/bindgen-setup + - uses: actions/cache@v4 with: path: | diff --git a/.github/workflows/include/bindgen-setup/action.yml b/.github/workflows/include/bindgen-setup/action.yml new file mode 100644 index 00000000000..89a5104db2a --- /dev/null +++ b/.github/workflows/include/bindgen-setup/action.yml @@ -0,0 +1,15 @@ +name: bindgen setup + +runs: + using: "composite" + steps: + - name: Install libclang + shell: bash + run: sudo apt update && sudo apt-get install -y libclang1 + + - uses: cargo-bins/cargo-binstall@main + + - name: Install bindgen + shell: bash + run: | + cargo binstall -y bindgen-cli@0.69.5 From f1754ec53886e61910d60eb351166d97a4b6f9a0 Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Mon, 21 Oct 2024 12:30:28 +0200 Subject: [PATCH 7/9] [integration] From 7ac53002dc3209262c619014d870e8ef0d832811 Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Mon, 21 Oct 2024 12:35:57 +0200 Subject: [PATCH 8/9] Disable http features of prometheus exporter --- Cargo.lock | 307 ++------------------------------ query-engine/metrics/Cargo.toml | 2 +- 2 files changed, 17 insertions(+), 292 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 83723a2d23a..4d0086b8640 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -205,12 +205,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "atty" version = "0.2.14" @@ -228,33 +222,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "aws-lc-rs" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd82dba44d209fddb11c190e0a94b78651f95299598e472215667417a03ff1d" -dependencies = [ - "aws-lc-sys", - "mirai-annotations", - "paste", - "zeroize", -] - -[[package]] -name = "aws-lc-sys" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7a4168111d7eb622a31b214057b8509c0a7e1794f44c546d742330dc793972" -dependencies = [ - "bindgen 0.69.5", - "cc", - "cmake", - "dunce", - "fs_extra", - "libc", - "paste", -] - [[package]] name = "backtrace" version = "0.3.68" @@ -345,29 +312,6 @@ dependencies = [ "shlex", ] -[[package]] -name = "bindgen" -version = "0.69.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" -dependencies = [ - "bitflags 2.4.0", - "cexpr", - "clang-sys", - "itertools 0.12.0", - "lazy_static", - "lazycell", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.58", - "which", -] - [[package]] name = "bit-vec" version = "0.6.3" @@ -585,8 +529,6 @@ version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ - "jobserver", - "libc", "shlex", ] @@ -1286,12 +1228,6 @@ dependencies = [ "wasm-rs-dbg", ] -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - [[package]] name = "either" version = "1.9.0" @@ -1615,12 +1551,6 @@ dependencies = [ "syn 2.0.58", ] -[[package]] -name = "fs_extra" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" - [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -1827,25 +1757,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "h2" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http 1.1.0", - "indexmap 2.2.2", - "slab", - "tokio", - "tokio-util 0.7.8", - "tracing", -] - [[package]] name = "half" version = "1.8.2" @@ -2023,29 +1934,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http 1.1.0", -] - -[[package]] -name = "http-body-util" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" -dependencies = [ - "bytes", - "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "pin-project-lite", -] - [[package]] name = "httparse" version = "1.8.0" @@ -2068,9 +1956,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.26", + "h2", "http 0.2.9", - "http-body 0.4.5", + "http-body", "httparse", "httpdate", "itoa", @@ -2082,53 +1970,13 @@ dependencies = [ "want", ] -[[package]] -name = "hyper" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "h2 0.4.6", - "http 1.1.0", - "http-body 1.0.1", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" -dependencies = [ - "futures-util", - "http 1.1.0", - "hyper 1.5.0", - "hyper-util", - "log", - "rustls 0.23.14", - "rustls-native-certs 0.8.0", - "rustls-pki-types", - "tokio", - "tokio-rustls 0.26.0", - "tower-service", -] - [[package]] name = "hyper-timeout" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.27", + "hyper", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -2141,31 +1989,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.27", + "hyper", "native-tls", "tokio", "tokio-native-tls", ] -[[package]] -name = "hyper-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http 1.1.0", - "http-body 1.0.1", - "hyper 1.5.0", - "pin-project-lite", - "socket2 0.5.7", - "tokio", - "tower-service", - "tracing", -] - [[package]] name = "iana-time-zone" version = "0.1.57" @@ -2335,15 +2164,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.65" @@ -2650,18 +2470,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4f0c8427b39666bf970460908b213ec09b3b350f20c0c2eabcbba51704a08e6" dependencies = [ "base64 0.22.1", - "http-body-util", - "hyper 1.5.0", - "hyper-rustls", - "hyper-util", "indexmap 2.2.2", - "ipnet", "metrics", "metrics-util", "quanta", "thiserror", - "tokio", - "tracing", ] [[package]] @@ -2716,12 +2529,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "mirai-annotations" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" - [[package]] name = "mobc" version = "0.8.5" @@ -2769,7 +2576,7 @@ dependencies = [ "rand 0.8.5", "rustc_version_runtime", "rustls 0.21.10", - "rustls-pemfile 1.0.3", + "rustls-pemfile", "serde", "serde_bytes", "serde_with", @@ -2929,7 +2736,7 @@ checksum = "9006c95034ccf7b903d955f210469119f6c3477fc9c9e7a7845ce38a3e665c2a" dependencies = [ "base64 0.13.1", "bigdecimal", - "bindgen 0.59.2", + "bindgen", "bitflags 1.3.2", "bitvec", "byteorder", @@ -3671,16 +3478,6 @@ dependencies = [ "yansi", ] -[[package]] -name = "prettyplease" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" -dependencies = [ - "proc-macro2", - "syn 2.0.58", -] - [[package]] name = "priority-queue" version = "1.3.2" @@ -4072,7 +3869,7 @@ dependencies = [ "connection-string", "enumflags2", "graphql-parser", - "hyper 0.14.27", + "hyper", "indoc 2.0.3", "mongodb-query-connector", "opentelemetry", @@ -4309,7 +4106,7 @@ dependencies = [ "async-trait", "colored", "enumflags2", - "hyper 0.14.27", + "hyper", "indexmap 2.2.2", "indoc 2.0.3", "insta", @@ -4623,10 +4420,10 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.26", + "h2", "http 0.2.9", - "http-body 0.4.5", - "hyper 0.14.27", + "http-body", + "hyper", "hyper-tls", "ipnet", "js-sys", @@ -4813,25 +4610,10 @@ checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring 0.17.7", - "rustls-webpki 0.101.7", + "rustls-webpki", "sct 0.7.0", ] -[[package]] -name = "rustls" -version = "0.23.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" -dependencies = [ - "aws-lc-rs", - "log", - "once_cell", - "rustls-pki-types", - "rustls-webpki 0.102.8", - "subtle", - "zeroize", -] - [[package]] name = "rustls-native-certs" version = "0.5.0" @@ -4844,19 +4626,6 @@ dependencies = [ "security-framework", ] -[[package]] -name = "rustls-native-certs" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" -dependencies = [ - "openssl-probe", - "rustls-pemfile 2.2.0", - "rustls-pki-types", - "schannel", - "security-framework", -] - [[package]] name = "rustls-pemfile" version = "1.0.3" @@ -4866,21 +4635,6 @@ dependencies = [ "base64 0.21.2", ] -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "rustls-pki-types" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" - [[package]] name = "rustls-webpki" version = "0.101.7" @@ -4891,18 +4645,6 @@ dependencies = [ "untrusted 0.9.0", ] -[[package]] -name = "rustls-webpki" -version = "0.102.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" -dependencies = [ - "aws-lc-rs", - "ring 0.17.7", - "rustls-pki-types", - "untrusted 0.9.0", -] - [[package]] name = "ryu" version = "1.0.15" @@ -6043,17 +5785,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" -dependencies = [ - "rustls 0.23.14", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.14" @@ -6115,16 +5846,16 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "h2 0.3.26", + "h2", "http 0.2.9", - "http-body 0.4.5", - "hyper 0.14.27", + "http-body", + "hyper", "hyper-timeout", "percent-encoding", "pin-project", "prost", "prost-derive", - "rustls-native-certs 0.5.0", + "rustls-native-certs", "tokio", "tokio-rustls 0.22.0", "tokio-stream", @@ -7066,9 +6797,3 @@ dependencies = [ "quote", "syn 2.0.58", ] - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/query-engine/metrics/Cargo.toml b/query-engine/metrics/Cargo.toml index 2bbb883dd8e..0abe32ac845 100644 --- a/query-engine/metrics/Cargo.toml +++ b/query-engine/metrics/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] metrics.workspace = true metrics-util = "0.17.0" -metrics-exporter-prometheus = "0.15.3" +metrics-exporter-prometheus = { version = "0.15.3", default-features = false } once_cell = "1.3" serde.workspace = true serde_json.workspace = true From 258fb1a4c294ad2edca36d27f497595df31cbc19 Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Mon, 21 Oct 2024 12:36:18 +0200 Subject: [PATCH 9/9] Revert "Install bindgen to build newer rustls on react-native" This reverts commit b83d79f661e0d7de075cb5932c047c662ff6a404. --- .../build-engines-react-native-template.yml | 4 ---- .../workflows/include/bindgen-setup/action.yml | 15 --------------- 2 files changed, 19 deletions(-) delete mode 100644 .github/workflows/include/bindgen-setup/action.yml diff --git a/.github/workflows/build-engines-react-native-template.yml b/.github/workflows/build-engines-react-native-template.yml index 89dbdb3be56..09cf6f6858b 100644 --- a/.github/workflows/build-engines-react-native-template.yml +++ b/.github/workflows/build-engines-react-native-template.yml @@ -26,8 +26,6 @@ jobs: with: ref: ${{ inputs.commit }} - - uses: ./.github/workflows/include/bindgen-setup - - uses: actions/cache@v4 with: path: | @@ -71,8 +69,6 @@ jobs: with: ref: ${{ inputs.commit }} - - uses: ./.github/workflows/include/bindgen-setup - - uses: actions/cache@v4 with: path: | diff --git a/.github/workflows/include/bindgen-setup/action.yml b/.github/workflows/include/bindgen-setup/action.yml deleted file mode 100644 index 89a5104db2a..00000000000 --- a/.github/workflows/include/bindgen-setup/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: bindgen setup - -runs: - using: "composite" - steps: - - name: Install libclang - shell: bash - run: sudo apt update && sudo apt-get install -y libclang1 - - - uses: cargo-bins/cargo-binstall@main - - - name: Install bindgen - shell: bash - run: | - cargo binstall -y bindgen-cli@0.69.5