Skip to content

Commit

Permalink
separate out metrics into a separate crate
Browse files Browse the repository at this point in the history
  • Loading branch information
codingkarthik committed Jun 10, 2024
1 parent c155e25 commit 42d362a
Show file tree
Hide file tree
Showing 13 changed files with 335 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ship.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ jobs:
sudo apt-get update
sudo apt-get install -y ${{ matrix.linux-packages }}
# - uses: Swatinem/rust-cache@v2
# with:
# shared-key: "build-${matrix.runner}" # share the cache across jobs
- uses: Swatinem/rust-cache@v2
with:
shared-key: "build-${matrix.runner}" # share the cache across jobs

- name: build the CLI
run: |
Expand Down
19 changes: 18 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"crates/query-engine/metadata",
"crates/query-engine/sql",
"crates/query-engine/translation",
"crates/query-engine/metrics",
"crates/cli",
]

Expand Down
2 changes: 1 addition & 1 deletion crates/configuration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ workspace = true

[dependencies]
query-engine-metadata = { path = "../query-engine/metadata" }
query-engine-execution = { path = "../query-engine/execution" }
query-engine-metrics = { path = "../query-engine/metrics" }


schemars = { version = "0.8.16", features = ["smol_str", "preserve_order"] }
Expand Down
6 changes: 3 additions & 3 deletions crates/configuration/src/version1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
use super::introspection;
use crate::error::Error;
use query_engine_execution::metrics;
use query_engine_metadata::metadata;
use query_engine_metadata::metadata::{database, Nullable};
use query_engine_metrics::metrics;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
Expand Down Expand Up @@ -74,7 +74,7 @@ pub struct Configuration {
#[derive(Debug)]
pub struct State {
pub mssql_pool: bb8::Pool<bb8_tiberius::ConnectionManager>,
pub metrics: query_engine_execution::metrics::Metrics,
pub metrics: query_engine_metrics::metrics::Metrics,
}

/// Validate the user configuration.
Expand All @@ -99,7 +99,7 @@ pub async fn create_state(
let mssql_pool = create_mssql_pool(&configuration.config)
.await
.map_err(InitializationError::UnableToCreateMSSQLPool)?;
let metrics = query_engine_execution::metrics::Metrics::initialize(metrics_registry)
let metrics = query_engine_metrics::metrics::Metrics::initialize(metrics_registry)
.map_err(InitializationError::MetricsError)?;
Ok(State {
mssql_pool,
Expand Down
1 change: 1 addition & 0 deletions crates/query-engine/execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ workspace = true
[dependencies]
query-engine-sql = { path = "../sql" }
query-engine-translation = { path = "../translation" }
query-engine-metrics = { path = "../metrics" }

tiberius = { version = "0.12.2", default-features = false, features = ["rustls"] }
bb8 = "0.8.1"
Expand Down
1 change: 0 additions & 1 deletion crates/query-engine/execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
pub mod error;
pub mod helpers;
pub mod metrics;
pub mod mutation;
pub mod query;
2 changes: 1 addition & 1 deletion crates/query-engine/execution/src/mutation.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::{
helpers::{execute_statement, rollback_on_exception},
metrics,
query::execute_query,
};
use bytes::{BufMut, Bytes, BytesMut};
use query_engine_metrics::metrics;
use query_engine_sql::sql::{
self,
ast::With,
Expand Down
2 changes: 1 addition & 1 deletion crates/query-engine/execution/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Execute a Query execution plan against the database.
use crate::metrics;
use bytes::{BufMut, Bytes, BytesMut};
use query_engine_metrics::metrics;

use crate::error::Error;
use query_engine_sql::sql;
Expand Down
19 changes: 19 additions & 0 deletions crates/query-engine/metrics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "query-engine-metrics"
version.workspace = true
edition.workspace = true

[lints]
workspace = true

[dependencies]
tiberius = { version = "0.12.2", default-features = false, features = ["rustls"] }
bb8 = "0.8.1"
bb8-tiberius = "0.15.0"
bytes = "1.6.0"
prometheus = "0.13.3"
serde_json = "1.0.116"
sqlformat = "0.2.3"
tokio-stream = "0.1.14"
tracing = "0.1.40"
thiserror = "1.0"
1 change: 1 addition & 0 deletions crates/query-engine/metrics/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions crates/query-engine/metrics/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod metrics;
Loading

0 comments on commit 42d362a

Please # to comment.