You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@auron.apache.org by "qingfei1994 (via GitHub)" <gi...@apache.org> on 2026/08/31 10:34:39 UTC
[PR] [AURON #2189] Periodically publish native metrics for long-running Fl… [auron]
qingfei1994 opened a new pull request, #2494:
URL: https://github.com/apache/auron/pull/2494
…ink tasks
# Which issue does this PR close?
Closes #2189
# Rationale for this change
Native DataFusion metrics were only published to `MetricNode` when the native runtime finalized. Spark batch tasks hit that path; long-running Flink tasks (Kafka source) do not, so Flink counters never moved after #2186 wired `add` to Flink.
# What changes are included in this PR?
- Periodic native metric publish on a tokio interval, sending positive deltas so incremental `MetricNode.add` does not double-count.
- Config `auron.metrics.update.interval.ms` (default 1000; 0 = finalize-only).
- `FlinkMetricNode.fromPlan` so Kafka (including fused `Project[Filter[KafkaScan]]`) and Calc share a plan-shaped metric tree for `getChild(i)`.
# Are there any user-facing changes?
Operators can set auron.metrics.update.interval.ms (default 1000ms). Spark SQL metrics may update during the job as a side effect of the same ticker.
# How was this patch tested?
- `cargo test -p auron metrics`
- Maven: `FlinkMetricNodeFromPlanTest`, `AuronKafkaSourceFunctionMergeTest`, `FlinkMetricNodeTest`, `AuronAdaptorTest`
# Was this patch authored or co-authored using generative AI tooling?
- [x] Yes
- [ ] No
If yes, include: `Generated-by: Cursor Grok 4.6`
ASF guidance: https://www.apache.org/legal/generative-tooling.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2189] Periodically publish native metrics for long-running Fl… [auron]
Posted by "Tartarus0zm (via GitHub)" <gi...@apache.org>.
Tartarus0zm commented on PR #2494:
URL: https://github.com/apache/auron/pull/2494#issuecomment-5493484372
hi @richox could you please help review this PR when you get a chance? Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2189] Periodically publish native metrics for long-running Flink tasks [auron]
Posted by "qingfei1994 (via GitHub)" <gi...@apache.org>.
qingfei1994 commented on PR #2494:
URL: https://github.com/apache/auron/pull/2494#issuecomment-5611618042
@richox @Tartarus0zm could you help review this pr?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2189] Periodically publish native metrics for long-running Fl… [auron]
Posted by "qingfei1994 (via GitHub)" <gi...@apache.org>.
qingfei1994 commented on PR #2494:
URL: https://github.com/apache/auron/pull/2494#issuecomment-5507288635
@richox I use a new configuration "auron.metrics.update.enabled", which is disabled by default and only when "flink.auron.metrics.update.enabled" = true and "flink.auron.metrics.update.interval.ms">0 will triggering the report metrics feature.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2189] Periodically publish native metrics for long-running Fl… [auron]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2494:
URL: https://github.com/apache/auron/pull/2494#discussion_r3930628179
##########
native-engine/auron/src/rt.rs:
##########
@@ -304,14 +328,56 @@ impl NativeExecutionRuntime {
}
fn update_metrics(&self) -> Result<()> {
- let metrics = jni_call!(
- AuronCallNativeWrapper(self.native_wrapper.as_obj()).getMetrics() -> JObject
- )?;
- update_metric_node(metrics.as_obj(), self.plan.clone())?;
- Ok(())
+ publish_plan_metrics(&self.native_wrapper, &self.plan, &self.metric_state)
}
}
+fn spawn_metrics_ticker(
+ tokio_runtime: &Runtime,
+ native_wrapper: GlobalRef,
+ plan: Arc<dyn ExecutionPlan>,
+ metric_state: Arc<Mutex<MetricSnapshot>>,
+ is_finalizing: Arc<AtomicBool>,
+) -> Option<JoinHandle<()>> {
+ let enabled = METRICS_UPDATE_ENABLED.value().unwrap_or(false);
+ if !enabled {
+ return None;
+ }
+ let interval_ms = METRICS_UPDATE_INTERVAL_MS.value().unwrap_or(1000);
+ if interval_ms <= 0 {
+ return None;
+ }
+
+ Some(tokio_runtime.spawn(async move {
+ let mut interval = tokio::time::interval(Duration::from_millis(interval_ms as u64));
+ // The first tick completes immediately; skip it so we do not JNI all-zero
+ // metrics.
+ interval.tick().await;
+ loop {
+ interval.tick().await;
+ if is_finalizing.load(Ordering::Acquire) {
+ break;
+ }
+ if let Err(err) = publish_plan_metrics(&native_wrapper, &plan, &metric_state) {
+ log::warn!("periodic metric update failed: {err}");
+ }
+ }
+ }))
+}
+
+fn publish_plan_metrics(
+ native_wrapper: &GlobalRef,
+ plan: &Arc<dyn ExecutionPlan>,
+ metric_state: &Mutex<MetricSnapshot>,
+) -> Result<()> {
+ let metrics = jni_call!(
+ AuronCallNativeWrapper(native_wrapper.as_obj()).getMetrics() -> JObject
+ )?;
+ let mut snapshot = metric_state.lock();
+ update_metric_node(metrics.as_obj(), plan.clone(), &mut snapshot)?;
Review Comment:
`publish_plan_metrics` acquires `metric_state` lock after calling into JNI (`getMetrics`). This means two concurrent publishes (e.g., the periodic ticker and `finalize()`'s final flush) can still overlap on the JNI call and `MetricNode` retrieval, despite the comment in `finalize()` suggesting serialization. Locking before `getMetrics` ensures the entire publish (including JNI) is serialized and avoids races during shutdown/finalization.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [AURON #2189] Periodically publish native metrics for long-running Fl… [auron]
Posted by "richox (via GitHub)" <gi...@apache.org>.
richox commented on PR #2494:
URL: https://github.com/apache/auron/pull/2494#issuecomment-5493795194
Thanks for implementing scheduled metric reporting in Auron.
Since this feature is currently only needed for Flink and not for Spark, I suggest adding a configuration item (e.g., `auron.metrics.ticker.enabled`) that is disabled by default and only enabled for Flink. This keeps the behavior opt-in and avoids unnecessary overhead for other engines.
Could you update the PR accordingly?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@auron.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org