Skip to content

Commit 56e8a87

Browse files
committed
fix(stack): validate frames with canonical sketch algorithms
1 parent e742bf8 commit 56e8a87

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

  • data_plane/src/drivers/ingest

‎data_plane/src/drivers/ingest/otel.rs‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ async fn route_modified_otlp_sketches_to_precompute(
12621262
derive_sketch_policy_fp(
12631263
ingest_state,
12641264
&canonical_name,
1265-
sketch_kind_handle_for(&dp),
1265+
sketch_algorithm_for(&dp),
12661266
&dp.container_config,
12671267
&dp.attrs.keys().cloned().collect(),
12681268
)
@@ -2099,7 +2099,7 @@ fn preflight_summary_frames(
20992099
ingest_state: &IngestState,
21002100
active: &crate::storage_engines::types::ActivePhysicalPlan,
21012101
) -> Result<(), String> {
2102-
let canonical_name = canonical_sketch_metric_name(metric_name, dp.kind);
2102+
let canonical_name = canonical_sketch_metric_name(metric_name, dp.algorithm.clone());
21032103
let frame =
21042104
take_summary_frame_identity(&mut dp.attrs, dp.start_time_unix_nano, dp.time_unix_nano)?;
21052105
if state_encoding_for_wire(dp.encoding) != Some(frame.encoding.clone()) {
@@ -2129,7 +2129,7 @@ fn preflight_summary_frames(
21292129
// A malformed full snapshot must not be discovered after an earlier
21302130
// frame in the request has already reached SketchStore.
21312131
if frame.kind == control_plane::physical::compiler::SummaryFrameKind::Full {
2132-
decode_modified_otlp_sketch_bytes(dp.kind, dp.encoding, &dp.sketch)
2132+
decode_modified_otlp_sketch_bytes(dp.algorithm.clone(), dp.encoding, &dp.sketch)
21332133
.map_err(|error| format!("invalid full frame for {metric_name}: {error}"))?;
21342134
}
21352135

@@ -2151,7 +2151,7 @@ fn preflight_summary_frames(
21512151
derive_sketch_policy_fp(
21522152
ingest_state,
21532153
canonical_name,
2154-
sketch_kind_handle_for(&dp),
2154+
sketch_algorithm_for(&dp),
21552155
&dp.container_config,
21562156
&dp.attrs.keys().cloned().collect(),
21572157
)
@@ -2184,13 +2184,13 @@ fn preflight_summary_frames(
21842184
.map(|(key, value)| (key.clone(), value.clone()))
21852185
.collect();
21862186
macro_rules! validate_points {
2187-
($points:expr, $kind:expr, $config:expr) => {{
2187+
($points:expr, $algorithm:expr, $config:expr) => {{
21882188
let config = $config;
21892189
for point in &$points {
21902190
validate_one(
21912191
&metric.name,
21922192
ModifiedOtlpSketchDp {
2193-
kind: $kind,
2193+
algorithm: $algorithm,
21942194
attrs: merge_point_attributes(&base_labels, &point.attributes),
21952195
time_unix_nano: point.time_unix_nano,
21962196
sketch: point.sketch.clone(),
@@ -2208,35 +2208,35 @@ fn preflight_summary_frames(
22082208
match &metric.data {
22092209
Some(Data::Ddsketch(data)) => validate_points!(
22102210
data.data_points,
2211-
SketchKind::DdSketch,
2211+
SketchAlgorithm::DDSketch,
22122212
crate::storage_engines::sketch_db::index::SketchConfig::DDSketch {
22132213
relative_accuracy: data.relative_accuracy,
22142214
}
22152215
),
22162216
Some(Data::Kllsketch(data)) => validate_points!(
22172217
data.data_points,
2218-
SketchKind::Kll,
2218+
SketchAlgorithm::Kll,
22192219
crate::storage_engines::sketch_db::index::SketchConfig::Kll { k: data.k }
22202220
),
22212221
Some(Data::Countsketch(data)) => validate_points!(
22222222
data.data_points,
2223-
SketchKind::CountSketch,
2223+
SketchAlgorithm::CountSketch,
22242224
crate::storage_engines::sketch_db::index::SketchConfig::CountSketch {
22252225
rows: data.rows,
22262226
cols: data.cols,
22272227
}
22282228
),
22292229
Some(Data::Countminsketch(data)) => validate_points!(
22302230
data.data_points,
2231-
SketchKind::CountMin,
2231+
SketchAlgorithm::Cms,
22322232
crate::storage_engines::sketch_db::index::SketchConfig::CountMin {
22332233
rows: data.rows,
22342234
cols: data.cols,
22352235
}
22362236
),
22372237
Some(Data::Hllsketch(data)) => validate_points!(
22382238
data.data_points,
2239-
SketchKind::Hll,
2239+
SketchAlgorithm::Hll,
22402240
crate::storage_engines::sketch_db::index::SketchConfig::Hll {
22412241
precision: data.precision,
22422242
}

0 commit comments

Comments
 (0)