anoopamS commented on code in PR #60135:
URL: https://github.com/apache/spark/pull/60135#discussion_r4595475182


##########
core/src/main/scala/org/apache/spark/status/api/v1/PrometheusResource.scala:
##########
@@ -113,7 +113,18 @@ private[spark] object PrometheusResource {
     val jerseyContext = new 
ServletContextHandler(ServletContextHandler.NO_SESSIONS)
     jerseyContext.setContextPath("/metrics")
     val holder: ServletHolder = new ServletHolder(classOf[ServletContainer])
-    holder.setInitParameter(ServerProperties.PROVIDER_PACKAGES, 
"org.apache.spark.status.api.v1")
+    // Register the JAX-RS resources explicitly by class name instead of 
scanning
+    // the package. Package scanning (PROVIDER_PACKAGES) relies on the 
classpath
+    // being enumerable from the filesystem, which fails when spark-core is 
loaded
+    // from a non-scannable location (e.g. an OSGi bundle where resources are
+    // exposed as "bundleresource://" URLs, or a shaded/modular classpath). The
+    // root resource PrometheusResource and the JacksonMessageWriter provider 
are
+    // sufficient for this endpoint.
+    holder.setInitParameter(
+      ServerProperties.PROVIDER_CLASSNAMES,
+      Seq(

Review Comment:
   - ApiRootResourceRegistrationSuite runs 6 tests on a live UI. It checks the 
core /api endpoints, a test resource contributed through the hook, 
   /metrics/executors/prometheus, and that /api/executors/prometheus and 
/metrics/v1/... now return 404.
     - StreamingApiRootResourceSuite is the first streaming REST test



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to