From 75c01f6b7cfe5f64f2993eff3ae3fc993b74d15a Mon Sep 17 00:00:00 2001 From: Stewart Jingga Date: Thu, 13 Jun 2024 11:43:34 +0700 Subject: [PATCH 1/2] feat(asset): revamp metric model --- gotocompany/assets/v1beta2/metric.proto | 40 ++++++++++++------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/gotocompany/assets/v1beta2/metric.proto b/gotocompany/assets/v1beta2/metric.proto index 4527355d..ba3e7441 100644 --- a/gotocompany/assets/v1beta2/metric.proto +++ b/gotocompany/assets/v1beta2/metric.proto @@ -11,27 +11,25 @@ option java_package = "com.gotocompany.assets"; // A metric is a timeseries aggregation over a table that supports zero or more dimensions. message Metric { - // Namespace of the metric. Something like `{project}-{model}` for dbt and - // `schema` for Cube. - string namespace = 1; - - // The field being used to calculate a metric. - string field_name = 2; - - // Type of the evaluated metric. ex: count_distinct, average etc. - string measure_type = 3; - - // Optional: The query, possibly in SQL representation, with filters and aggregations. - string query = 4; - - // Optional: List of attributes the metric has. This could include the - // following: - // - time_grains[repeated string]: One or more "grains" at which the metric - // can be evaluated. Ex: [day, week, month]. - // - dimensions[repeated string]: A list of dimensions to group or filter the - // metric by. Ex: [plan, country]. - // - filters[repeated map]: Predicates for the metric. Ex: - // [{"field": "is_paying", "operator": "is", "value": "true"}]. + // Metric's definition. Can be in a text describing the metrics or a formula. + string definition = 1; + + // A query on how to calculate and generate the metric. + // Metric is not defined by where it is stored, but instead on how it is generated. + string query = 2; + + // Team owning the metric's definition. + string team = 3; + + // Optional: This field can be utilised to group multiple metrics. + // We can utilise this field to group the following two different metrics "GMV Product A" and "GMV Product B". + // In the example above, this "group" field can be "GMV" for both metrics. + string group = 4; + + // Optional: This field can be used as a flag for metric verification + bool is_verified = 5; + + // List of attributes the model has. google.protobuf.Struct attributes = 5; // The timestamp of the metric's creation. From 7ca46b678b58c5e302a85dc034166c253c5bd440 Mon Sep 17 00:00:00 2001 From: Stewart Jingga Date: Thu, 13 Jun 2024 11:45:15 +0700 Subject: [PATCH 2/2] fix(asset): duplicate tag in Metric --- gotocompany/assets/v1beta2/metric.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gotocompany/assets/v1beta2/metric.proto b/gotocompany/assets/v1beta2/metric.proto index ba3e7441..445a7f70 100644 --- a/gotocompany/assets/v1beta2/metric.proto +++ b/gotocompany/assets/v1beta2/metric.proto @@ -30,7 +30,7 @@ message Metric { bool is_verified = 5; // List of attributes the model has. - google.protobuf.Struct attributes = 5; + google.protobuf.Struct attributes = 10; // The timestamp of the metric's creation. google.protobuf.Timestamp create_time = 101;