Publish op-time companions at MODERATE metrics level - #15414
Conversation
Signed-off-by: Hongbin Ma <mahongbin@apache.org>
Signed-off-by: Hongbin Ma <mahongbin@apache.org>
| NUM_OUTPUT_ROWS -> createMetric(outputRowsLevel, DESCRIPTION_NUM_OUTPUT_ROWS), | ||
| NUM_OUTPUT_BATCHES -> createMetric(outputBatchesLevel, DESCRIPTION_NUM_OUTPUT_BATCHES), | ||
| OP_TIME_NEW -> createNanoTimingMetric(MODERATE_LEVEL, DESCRIPTION_OP_TIME_NEW)) ++ | ||
| OP_TIME_NEW -> createOpTimeMetric(DESCRIPTION_OP_TIME_NEW)) ++ |
There was a problem hiding this comment.
Spark 4.2 scan companion omitted
When a DataSource V2 batch scan runs on Spark 4.2 at the default MODERATE metrics level, its allMetrics override bypasses this changed map and still constructs OP_TIME_NEW through the ordinary timing factory, so opTimeNew_exSemWait is absent from event logs.
Knowledge Base Used: Plugin Entrypoint and GPU Overrides
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Fixed in b363d91. The Spark 4.2 GpuBatchScanExec allMetrics override now uses createOpTimeMetric, and a Spark 4.2-specific suite verifies that both opTimeNew and opTimeNew_exSemWait are published at MODERATE.
Validation: mvn -B -f scala2.13/pom.xml -Dbuildver=420 -pl sql-plugin -Dsuites=com.nvidia.spark.rapids.shims.spark420.GpuBatchScanExecSuite test and the repository-wide scalastyle check both pass.
Greptile SummaryThe PR keeps the default metrics level at
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the prior Spark 4.2 batch-scan omission is corrected by routing its overridden operator-time metric through the new companion-producing factory. Important Files Changed
Reviews (2): Last reviewed commit: "Publish Spark 4.2 batch scan op-time com..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR makes operator-time metrics publish their semaphore-excluded companion (the “exSemWait” accumulator) at the default MODERATE metrics level, while leaving spark.rapids.sql.metrics.level defaulting to MODERATE. This improves event-log–based analysis by exposing both raw operator time and operator time excluding GPU semaphore wait without requiring a DEBUG rerun.
Changes:
- Introduces
GpuMetricFactory.createOpTime(...)andGpuExec.createOpTimeMetric(...)to create op-time metrics whose semaphore-excluded companion is enabled atMODERATE. - Switches operator-time metric creation across core execs (operators, scans, shuffle read/write, Python exec, columnar-to-row, and write stats) to use the new op-time factory path.
- Updates configuration docs and adds a unit test to verify companion publication behavior and validate the per-operator serialized-accumulator overhead.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuMetrics.scala | Adds createOpTime and refactors internal factory logic to control companion publication level per metric kind. |
| sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuExec.scala | Adds createOpTimeMetric and switches the default OP_TIME_NEW metric to use it. |
| sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuColumnarToRowExec.scala | Switches OP_TIME_NEW to createOpTimeMetric so companions publish at MODERATE. |
| sql-plugin/src/main/scala/org/apache/spark/sql/rapids/GpuFileSourceScanExec.scala | Switches scan OP_TIME_NEW to createOpTimeMetric. |
| sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/python/GpuPythonExecBase.scala | Switches Python exec OP_TIME_NEW to createOpTimeMetric. |
| sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/GpuShuffleExchangeExecBase.scala | Switches shuffle read/write op-time metrics to createOpTimeMetric. |
| sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/GpuCustomShuffleReaderExec.scala | Switches shuffle reader op-time metric to createOpTimeMetric. |
| sql-plugin/src/main/scala/org/apache/spark/sql/rapids/GpuWriteStatsTracker.scala | Uses createOpTime for write stats operatorTime metric so companions publish at MODERATE. |
| sql-plugin/src/main/scala/org/apache/spark/rapids/hybrid/HybridFileSourceScanExec.scala | Switches hybrid scan OP_TIME_NEW to createOpTimeMetric. |
| sql-plugin/src/main/scala/com/nvidia/spark/rapids/RapidsConf.scala | Updates metrics-level description to reflect op-time companion availability at MODERATE. |
| docs/configs.md | Mirrors the updated spark.rapids.sql.metrics.level documentation text. |
| sql-plugin/src/test/scala/com/nvidia/spark/rapids/GpuMetricFactorySuite.scala | Adds tests for companion publication levels and serialized-accumulator overhead impact. |
Signed-off-by: Hongbin Ma <mahongbin@apache.org>
|
build |
Description
Keep
spark.rapids.sql.metrics.leveldefaulting toMODERATE, while publishing the semaphore-excluded companion for the new operator-time metrics at that level.This introduces a dedicated
createOpTimefactory path and applies it to regular GPU operators, scans, columnar-to-row, Python execution, write statistics, and shuffle read/write operator-time metrics. Other timing metrics continue to publish their semaphore-excluded companions only atDEBUG.The goal is to make quantitative event-log analysis of raw operator time versus operator time excluding GPU semaphore wait available from the default metrics level, without asking customers to enable
DEBUGand rerun the workload. This is the narrower follow-up to #15400, which changed the global default toDEBUG.Serialized task-result impact
Each published operator-time metric adds exactly one accumulator companion. A focused Spark closure-serializer test using 100 operator-time metrics measured:
This measurement isolates the serialized accumulator payload; it is not an end-to-end
DirectTaskResultsize measurement. Actual task-result size depends on the executed plan, the number of published SQL metrics, Spark version, and serializer.Testing
mvn -B -pl sql-plugin -am test -DwildcardSuites=com.nvidia.spark.rapids.GpuMetricFactorySuite,com.nvidia.spark.rapids.GpuMetricsSuitemvn -B -pl tests -am test -DwildcardSuites=com.nvidia.spark.rapids.GpuMetricCompanionSuitemvn -B -N verify -DskipTestsDocumentation
Testing
Performance