Skip to content

Commit

Permalink
refactor: updates from review, finishing draft work, edge-to-bin conv…
Browse files Browse the repository at this point in the history
…ersion on histo creation
  • Loading branch information
zeeshanlakhani committed Jun 18, 2024
1 parent b5ca859 commit e6d808d
Show file tree
Hide file tree
Showing 16 changed files with 854 additions and 1,001 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

221 changes: 80 additions & 141 deletions oximeter/db/schema/replicated/5/up.sql

Large diffs are not rendered by default.

260 changes: 100 additions & 160 deletions oximeter/db/schema/replicated/db-init.sql

Large diffs are not rendered by default.

111 changes: 40 additions & 71 deletions oximeter/db/schema/single-node/5/up.sql

Large diffs are not rendered by default.

130 changes: 50 additions & 80 deletions oximeter/db/schema/single-node/db-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogrami8
min Int8,
max Int8,
sum_of_samples Int64,
sum_of_squares Int64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -268,19 +265,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogramu8
min UInt8,
max UInt8,
sum_of_samples Int64,
sum_of_squares Int64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -297,19 +291,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogrami16
min Int16,
max Int16,
sum_of_samples Int64,
sum_of_squares Int64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -326,19 +317,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogramu16
min UInt16,
max UInt16,
sum_of_samples Int64,
sum_of_squares Int64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -355,19 +343,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogrami32
min Int32,
max Int32,
sum_of_samples Int64,
sum_of_squares Int64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -384,19 +369,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogramu32
min UInt32,
max UInt32,
sum_of_samples Int64,
sum_of_squares Int64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -413,19 +395,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogrami64
min Int64,
max Int64,
sum_of_samples Int64,
sum_of_squares Int64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -442,19 +421,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogramu64
min UInt64,
max UInt64,
sum_of_samples Int64,
sum_of_squares Int64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -471,19 +447,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogramf32
min Float32,
max Float32,
sum_of_samples Float64,
sum_of_squares Float64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand All @@ -500,19 +473,16 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_histogramf64
min Float64,
max Float64,
sum_of_samples Float64,
sum_of_squares Float64,
squared_mean Float64,
p50_marker_heights Array(Float64),
p50_marker_positions Array(Int64),
p50_marker_positions Array(UInt64),
p50_desired_marker_positions Array(Float64),
p50_desired_marker_increments Array(Float64),
p90_marker_heights Array(Float64),
p90_marker_positions Array(Int64),
p90_marker_positions Array(UInt64),
p90_desired_marker_positions Array(Float64),
p90_desired_marker_increments Array(Float64),
p99_marker_heights Array(Float64),
p99_marker_positions Array(Int64),
p99_desired_marker_positions Array(Float64),
p99_desired_marker_increments Array(Float64)
p99_marker_positions Array(UInt64),
p99_desired_marker_positions Array(Float64)
)
ENGINE = MergeTree()
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
Expand Down
4 changes: 1 addition & 3 deletions oximeter/db/src/bin/oxdb/oxql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub(crate) fn prepare_columns(
cols.push(special_idents::SUM_OF_SAMPLES.into());
types.push(special_idents::UINT64.into());

cols.push(special_idents::SUM_OF_SQUARES.into());
cols.push(special_idents::SQUARED_MEAN.into());
types.push(special_idents::UINT64.into());

for quantile in ["P50", "P90", "P99"].iter() {
Expand All @@ -195,8 +195,6 @@ pub(crate) fn prepare_columns(
types.push(special_idents::ARRAYINT64.into());
cols.push(format!("{}_DESIRED_MARKER_POSITIONS", quantile));
types.push(special_idents::ARRAYFLOAT64.into());
cols.push(format!("{}_DESIRED_MARKER_INCREMENTS", quantile));
types.push(special_idents::ARRAYFLOAT64.into());
}
} else if schema.datum_type.is_cumulative() {
cols.push(special_idents::START_TIME.into());
Expand Down
10 changes: 5 additions & 5 deletions oximeter/db/src/client/oxql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,13 +826,13 @@ impl Client {
) -> String {
let value_columns = if datum_type.is_histogram() {
r#"timeseries_key, start_time, timestamp, bins, counts, min, max,
sum_of_samples, sum_of_squares,
sum_of_samples, squared_mean,
p50_marker_heights, p50_marker_positions,
p50_desired_marker_positions, p50_desired_marker_increments,
p50_desired_marker_positions,
p90_marker_heights, p90_marker_positions,
p90_desired_marker_positions, p90_desired_marker_increments
p90_desired_marker_positions,
p99_marker_heights, p99_marker_positions,
p99_desired_marker_positions, p99_desired_marker_increments"#
p99_desired_marker_positions"#
} else if datum_type.is_cumulative() {
"timeseries_key, start_time, timestamp, datum"
} else {
Expand Down Expand Up @@ -1210,7 +1210,7 @@ mod tests {
// Create the first metric, starting from a count of 0.
let mut metric = SomeMetric { foo: *foo, datum };

// Create all the samples,, incrementing the datum and sample
// Create all the samples, incrementing the datum and sample
// time.
for i in 0..N_SAMPLES_PER_TIMESERIES {
let sample_time =
Expand Down
Loading

0 comments on commit e6d808d

Please sign in to comment.