Skip to content

Conversation

@jayshrivastava
Copy link
Collaborator

This change adds a metrics module containing proto definitions to mirror datafusion metrics. These will be used for EXPLAIN ANALYZE. It also adds roundtrip serialization tests.

Informs #123.

@jayshrivastava jayshrivastava marked this pull request as ready for review September 17, 2025 15:49
Copy link
Collaborator

@gabotechs gabotechs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! just left some minor comments, but none are blocking so leaving a +1


/// A ProtoMetric is a protobuf mirror of [datafusion::physical_plan::metrics::Metric].
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProtoMetric {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: in other parts of the project we name the "proto" version of other structs by appending the Proto keyword as a suffix. How about also doing it here and naming things MetricProto, MetricsSetProto, etc...?

Comment on lines 411 to 413
None => Err(DataFusionError::Internal(
"proto metric is missing the metric field".to_string(),
)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: A short version of this could be:

Suggested change
None => Err(DataFusionError::Internal(
"proto metric is missing the metric field".to_string(),
)),
None => internal_err!("proto metric is missing the metric field"),

let test_cases = vec![
TestCase {
name: "empty",
metrics_set: Box::new(|| MetricsSet::new()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 clippy should be failing here pointing you to do something like:

Suggested change
metrics_set: Box::new(|| MetricsSet::new()),
metrics_set: Box::new(MetricsSet::new),

I wonder why pipelines are passing... maybe we are not correctly running clippy under tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oo nice catch

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the clippy command in CI to use --all-targets and --features integration

This change adds a metrics module containing proto definitions to mirror datafusion metrics. These will be used for EXPLAIN ANALYZE. It also adds roundtrip serialization tests.

Informs #123.
@gabotechs gabotechs merged commit 682967f into main Sep 17, 2025
4 checks passed
@gabotechs gabotechs deleted the js/metrics-proto branch September 17, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants