dongjoon-hyun commented on code in PR #947:
URL: 
https://github.com/apache/spark-kubernetes-operator/pull/947#discussion_r4208738569


##########
spark-operator/src/main/java/org/apache/spark/k8s/operator/metrics/source/KubernetesMetricsInterceptor.java:
##########
@@ -217,14 +221,14 @@ private Meter getMeterByResponseCode(int code) {
    * Parses the given path to extract namespace-scoped resource information.
    *
    * @param path The request path.
-   * @return An Optional containing a Pair of namespace and resource name, or 
empty if not found.
+   * @return An Optional containing a Pair of namespace and resource name, or 
empty if the path has
+   *     no {@code namespaces/<namespace>/<resource>} segments.
    */
   public Optional<Pair<String, String>> parseNamespaceScopedResource(String 
path) {
-    if (path.contains(NAMESPACES)) {
-      int index = path.indexOf(NAMESPACES) + NAMESPACES.length();
-      String namespaceAndResources = path.substring(index + 1);
-      String[] parts = namespaceAndResources.split("/");
-      return Optional.of(Pair.of(parts[0], parts[1]));
+    List<String> segments = Arrays.asList(path.split("/"));

Review Comment:
   Thank you, @peter-toth. You're right. I also ran the three Kueue lookups 
with the name `all-namespaces` and the parsing of the base. 
`KueueWorkloadUtils.requestAdmission`, for `WorkloadPriorityClass` and 
`PriorityClass`, and `KueueWorkloadUtils.resolvePodSetFlavors` throw the raw 
`StringIndexOutOfBoundsException`, while they throw the expected not-found 
exceptions with this PR. I updated the PR description.
   



-- 
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