This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 620f16ed0afe [SPARK-48400][CORE] Promote `PrometheusServlet` to 
`DeveloperApi`
620f16ed0afe is described below

commit 620f16ed0afeebce32ddf1a800ce4c64129bd389
Author: zhou-jiang <[email protected]>
AuthorDate: Wed Aug 28 10:20:20 2024 -0700

    [SPARK-48400][CORE] Promote `PrometheusServlet` to `DeveloperApi`
    
    ### What changes were proposed in this pull request?
    
    This PR aims to promote `PrometheusServlet` to `DeveloperApi`
    
    ### Why are the changes needed?
    
    Since Apache Spark Kubernetes Operator requires this, we had better 
maintain it as a developer API officially from Apache Spark 4.0.0.
    
    https://github.com/apache/spark-kubernetes-operator/pull/12
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    Pass the CIs
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No
    
    Closes #46716 from jiangzho/metrics_snapshot.
    
    Authored-by: zhou-jiang <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../org/apache/spark/metrics/sink/PrometheusServlet.scala     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/core/src/main/scala/org/apache/spark/metrics/sink/PrometheusServlet.scala 
b/core/src/main/scala/org/apache/spark/metrics/sink/PrometheusServlet.scala
index 757139528996..2ab49eae8cd8 100644
--- a/core/src/main/scala/org/apache/spark/metrics/sink/PrometheusServlet.scala
+++ b/core/src/main/scala/org/apache/spark/metrics/sink/PrometheusServlet.scala
@@ -24,15 +24,21 @@ import jakarta.servlet.http.HttpServletRequest
 import org.eclipse.jetty.servlet.ServletContextHandler
 
 import org.apache.spark.SparkConf
+import org.apache.spark.annotation.{DeveloperApi, Since, Unstable}
 import org.apache.spark.ui.JettyUtils._
 
 /**
+ * :: DeveloperApi ::
  * This exposes the metrics of the given registry with Prometheus format.
  *
  * The output is consistent with /metrics/json result in terms of item ordering
  * and with the previous result of Spark JMX Sink + Prometheus JMX Converter 
combination
  * in terms of key string format.
+ *
+ * This is used by Spark MetricsSystem internally and Spark K8s operator.
  */
+@Unstable
+@DeveloperApi
 private[spark] class PrometheusServlet(
     val property: Properties, val registry: MetricRegistry) extends Sink {
 
@@ -47,7 +53,10 @@ private[spark] class PrometheusServlet(
     )
   }
 
-  def getMetricsSnapshot(request: HttpServletRequest): String = {
+  def getMetricsSnapshot(request: HttpServletRequest): String = 
getMetricsSnapshot()
+
+  @Since("4.0.0")
+  def getMetricsSnapshot(): String = {
     import scala.jdk.CollectionConverters._
 
     val gaugesLabel = """{type="gauges"}"""


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to