-
Notifications
You must be signed in to change notification settings - Fork 695
de: tp: Add metrics v2 node #4756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -250,6 +250,16 @@ class PERFETTO_EXPORT_COMPONENT TraceProcessor : public TraceProcessorStorage { | |
| // materialization of structured queries. On success, |out| is populated with | ||
| // the new instance and ownership is transferred to the caller. | ||
| virtual base::Status CreateSummarizer(std::unique_ptr<Summarizer>* out) = 0; | ||
|
|
||
| // EXPERIMENTAL: Converts a proto from binary format to textproto format. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No sorry please don't add a function like this, this is totally not the right thing to do. You should be able to convert to text proto in JavaScript without going to trace processor. If you need to do it on c++ see how it's done for trace config and generalize. I've allowed ad-hoc changes on TP and not looked too closely but this is where I draw the line. I don't want to add random things in TP just because it's convenient for explore page.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add functionality to go from protojs to text proto without TP, but I don't get the strong reaction. So far, this is what we have been always doing. To get trace config, in recording page, in Data explorer. The idea of continuing with it was not so random.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No the reaction here is because you are basically just dumping a shortcut to do proto to prototext of any proto trace processor understands. That's not the job of trace processor and I think that should be reasonably clear |
||
| // `proto_type` is the fully qualified proto type name (e.g., | ||
| // ".perfetto.protos.TraceSummarySpec"). | ||
| // `proto_bytes` contains the binary proto data. | ||
| // The result is written to `output`. | ||
| virtual base::Status ProtoToText(const std::string& proto_type, | ||
| const uint8_t* proto_bytes, | ||
| size_t proto_size, | ||
| std::string* output) = 0; | ||
| }; | ||
|
|
||
| } // namespace perfetto::trace_processor | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Metrics | ||
|
|
||
| **Purpose:** Define trace-based metrics from your query results. This node packages your data into a `TraceMetricV2TemplateSpec` proto (metric bundle) that can be exported and used in trace analysis pipelines. The selected value column becomes the metric value, and all other columns become dimensions. | ||
|
|
||
| **How to use:** | ||
|
|
||
| 1. **Connect an input:** This node requires a source of data (e.g., from a Table Source or after filtering/aggregating data) | ||
|
|
||
| 2. **Set Metric ID Prefix:** Give your metric a unique identifier prefix (e.g., `cpu_metrics`, `memory_usage`). The metric will be named `<prefix>_<column_name>`. | ||
|
|
||
| 3. **Select a Value Column:** Choose a numeric column (int, double, etc.) that contains the metric value you want to track. Then configure: | ||
| - **Unit:** Select the appropriate unit for the metric values (Count, Time, Bytes, Percentage, etc.). Use "Custom" for units not in the predefined list. | ||
| - **Polarity:** Indicate whether higher or lower values are "better" | ||
| - Higher is Better: e.g., throughput, cache hit rate | ||
| - Lower is Better: e.g., latency, error count | ||
| - Not Applicable: for metrics where direction doesn't apply | ||
|
|
||
| 4. **Configure Dimension Uniqueness:** Specify whether dimension combinations are unique | ||
| - Unique: Each combination of dimension values appears at most once | ||
| - Not Unique: The same dimension combination may appear multiple times | ||
|
|
||
| **Dimensions:** | ||
| All columns in your input **except** the value column automatically become dimensions. Use a Modify Columns node before this one to control which columns are included as dimensions. | ||
|
|
||
| **Export:** | ||
| Click the "Export" button to generate a textproto representation of your metric template specification. This can be saved and used in trace analysis pipelines. | ||
|
|
||
| **Example workflow:** | ||
| 1. Start with a Table Source (e.g., `slice` table) | ||
| 2. Add Aggregation to compute `SUM(dur)` grouped by `process_name` | ||
| 3. Add Metrics node: | ||
| - Metric ID Prefix: `slice_stats` | ||
| - Value column: `sum_dur` with Unit: Time (nanoseconds), Polarity: Not Applicable | ||
| 4. Export the metric spec | ||
|
|
||
| This creates a metric `slice_stats_sum_dur` with `process_name` as a dimension. | ||
|
|
||
| **Output:** The node passes through input columns unchanged. The metric template specification is generated separately via the Export button. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhhhhh why do you need this? This seems totally unnecessary.