Skip to content

Commit

Permalink
[spr] initial version
Browse files Browse the repository at this point in the history
Created using spr 1.3.6-beta.1
  • Loading branch information
sunshowers committed Aug 16, 2024
1 parent 66ac7b3 commit 8530f17
Show file tree
Hide file tree
Showing 29 changed files with 635 additions and 568 deletions.
94 changes: 59 additions & 35 deletions Cargo.lock

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

12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ members = [
"oximeter/api",
"oximeter/collector",
"oximeter/db",
"oximeter/impl",
"oximeter/instruments",
"oximeter/oximeter-macro-impl",
"oximeter/oximeter",
"oximeter/producer",
"oximeter/schema",
"oximeter/timeseries-macro",
"oximeter/test-utils",
"oximeter/types",
"package",
"passwords",
"rpaths",
Expand Down Expand Up @@ -191,12 +193,14 @@ default-members = [
"oximeter/api",
"oximeter/collector",
"oximeter/db",
"oximeter/impl",
"oximeter/instruments",
"oximeter/oximeter-macro-impl",
"oximeter/oximeter",
"oximeter/producer",
"oximeter/schema",
"oximeter/test-utils",
"oximeter/timeseries-macro",
"oximeter/types",
"package",
"passwords",
"rpaths",
Expand Down Expand Up @@ -459,11 +463,13 @@ oximeter-api = { path = "oximeter/api" }
oximeter-client = { path = "clients/oximeter-client" }
oximeter-db = { path = "oximeter/db/", default-features = false }
oximeter-collector = { path = "oximeter/collector" }
oximeter-impl = { path = "oximeter/impl" }
oximeter-instruments = { path = "oximeter/instruments" }
oximeter-macro-impl = { path = "oximeter/oximeter-macro-impl" }
oximeter-producer = { path = "oximeter/producer" }
oximeter-schema = { path = "oximeter/schema" }
oximeter-test-utils = { path = "oximeter/test-utils" }
oximeter-timeseries-macro = { path = "oximeter/timeseries-macro" }
oximeter-types = { path = "oximeter/types" }
p256 = "0.13"
parse-display = "0.10.0"
partial-io = { version = "0.5.4", features = ["proptest1", "tokio1"] }
Expand Down
1 change: 1 addition & 0 deletions oximeter/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ expectorate.workspace = true
indexmap.workspace = true
itertools.workspace = true
omicron-test-utils.workspace = true
oximeter-test-utils.workspace = true
slog-dtrace.workspace = true
sqlformat.workspace = true
sqlparser.workspace = true
Expand Down
27 changes: 13 additions & 14 deletions oximeter/db/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,6 @@ mod tests {
};
use omicron_test_utils::dev::test_setup_log;
use oximeter::histogram::Histogram;
use oximeter::test_util;
use oximeter::types::MissingDatum;
use oximeter::Datum;
use oximeter::FieldValue;
Expand Down Expand Up @@ -1723,7 +1722,7 @@ mod tests {
let samples = {
let mut s = Vec::with_capacity(8);
for _ in 0..s.capacity() {
s.push(test_util::make_hist_sample())
s.push(oximeter_test_utils::make_hist_sample())
}
s
};
Expand Down Expand Up @@ -1762,15 +1761,15 @@ mod tests {

let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let sample = test_util::make_sample();
let sample = oximeter_test_utils::make_sample();
client.insert_samples(&[sample]).await.unwrap();

let bad_name = name_mismatch::TestTarget {
name: "first_name".into(),
name2: "second_name".into(),
num: 2,
};
let metric = test_util::TestMetric {
let metric = oximeter_test_utils::TestMetric {
id: uuid::Uuid::new_v4(),
good: true,
datum: 1,
Expand All @@ -1792,7 +1791,7 @@ mod tests {

let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let sample = test_util::make_sample();
let sample = oximeter_test_utils::make_sample();

// Verify that this sample is considered new, i.e., we return rows to update the timeseries
// schema table.
Expand Down Expand Up @@ -1867,7 +1866,7 @@ mod tests {

let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let samples = test_util::generate_test_samples(2, 2, 2, 2);
let samples = oximeter_test_utils::generate_test_samples(2, 2, 2, 2);
client.insert_samples(&samples).await?;

let sample = samples.first().unwrap();
Expand Down Expand Up @@ -1956,7 +1955,7 @@ mod tests {
// we'd like to exercise the logic of ClickHouse's replacing merge tree engine.
let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let samples = test_util::generate_test_samples(2, 2, 2, 2);
let samples = oximeter_test_utils::generate_test_samples(2, 2, 2, 2);
client.insert_samples(&samples).await?;

async fn assert_table_count(
Expand Down Expand Up @@ -2631,7 +2630,7 @@ mod tests {

let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let samples = test_util::generate_test_samples(2, 2, 2, 2);
let samples = oximeter_test_utils::generate_test_samples(2, 2, 2, 2);
client.insert_samples(&samples).await?;

let original_schema = client.schema.lock().await.clone();
Expand All @@ -2656,7 +2655,7 @@ mod tests {

let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let samples = test_util::generate_test_samples(2, 2, 2, 2);
let samples = oximeter_test_utils::generate_test_samples(2, 2, 2, 2);
client.insert_samples(&samples).await?;

let limit = 100u32.try_into().unwrap();
Expand Down Expand Up @@ -2691,7 +2690,7 @@ mod tests {

let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let samples = test_util::generate_test_samples(2, 2, 2, 2);
let samples = oximeter_test_utils::generate_test_samples(2, 2, 2, 2);
client.insert_samples(&samples).await?;

let limit = 7u32.try_into().unwrap();
Expand Down Expand Up @@ -3364,7 +3363,7 @@ mod tests {
// The values here don't matter much, we just want to check that
// the database data hasn't been dropped.
assert_eq!(0, get_schema_count(&client).await);
let sample = test_util::make_sample();
let sample = oximeter_test_utils::make_sample();
client.insert_samples(&[sample.clone()]).await.unwrap();
assert_eq!(1, get_schema_count(&client).await);

Expand Down Expand Up @@ -3438,7 +3437,7 @@ mod tests {
// The values here don't matter much, we just want to check that
// the database data gets dropped later.
assert_eq!(0, get_schema_count(&client).await);
let sample = test_util::make_sample();
let sample = oximeter_test_utils::make_sample();
client.insert_samples(&[sample.clone()]).await.unwrap();
assert_eq!(1, get_schema_count(&client).await);

Expand All @@ -3464,7 +3463,7 @@ mod tests {

let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let samples = [test_util::make_sample()];
let samples = [oximeter_test_utils::make_sample()];
client.insert_samples(&samples).await.unwrap();

// Get the count of schema directly from the DB, which should have just
Expand Down Expand Up @@ -3549,7 +3548,7 @@ mod tests {

let client = Client::new(address, &log);
db_type.init_db(&client).await.unwrap();
let samples = [test_util::make_sample()];
let samples = [oximeter_test_utils::make_sample()];

// We're using the components of the `insert_samples()` method here,
// which has been refactored explicitly for this test. We need to insert
Expand Down
9 changes: 4 additions & 5 deletions oximeter/db/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,6 @@ mod tests {
use super::*;
use chrono::Timelike;
use oximeter::histogram::Record;
use oximeter::test_util;
use oximeter::Datum;

#[test]
Expand Down Expand Up @@ -1983,7 +1982,7 @@ mod tests {

#[test]
fn test_unroll_from_source() {
let sample = test_util::make_sample();
let sample = oximeter_test_utils::make_sample();
let out = unroll_from_source(&sample);
assert_eq!(out["oximeter.fields_string"].len(), 2);
assert_eq!(out["oximeter.fields_i64"].len(), 1);
Expand All @@ -2003,8 +2002,8 @@ mod tests {
// datum.
#[test]
fn test_unroll_missing_measurement_row() {
let sample = test_util::make_sample();
let missing_sample = test_util::make_missing_sample();
let sample = oximeter_test_utils::make_sample();
let missing_sample = oximeter_test_utils::make_missing_sample();
let (table_name, row) = unroll_measurement_row(&sample);
let (missing_table_name, missing_row) =
unroll_measurement_row(&missing_sample);
Expand All @@ -2022,7 +2021,7 @@ mod tests {

#[test]
fn test_unroll_measurement_row() {
let sample = test_util::make_hist_sample();
let sample = oximeter_test_utils::make_hist_sample();
let (table_name, row) = unroll_measurement_row(&sample);
assert_eq!(table_name, "oximeter.measurements_histogramf64");
let unpacked: HistogramF64MeasurementRow =
Expand Down
Loading

0 comments on commit 8530f17

Please sign in to comment.