peter-toth commented on code in PR #917:
URL: 
https://github.com/apache/spark-kubernetes-operator/pull/917#discussion_r4158980368


##########
docs/configuration.md:
##########
@@ -213,26 +213,27 @@ via [Codahale JVM 
Metrics](https://javadoc.io/doc/com.codahale.metrics/metrics-j
 
 ### Kubernetes Client Metrics
 
-| Metrics Name                                              | Type       | 
Description                                                                     
                                         |
-|-----------------------------------------------------------|------------|--------------------------------------------------------------------------------------------------------------------------|
-| kubernetes.client.http.request                            | Meter      | 
Tracking the rates of HTTP request sent to the Kubernetes API Server            
                                         |
-| kubernetes.client.http.response                           | Meter      | 
Tracking the rates of HTTP response from the Kubernetes API Server              
                                         |
-| kubernetes.client.http.response.failed                    | Meter      | 
Tracking the rates of HTTP requests which have no response from the Kubernetes 
API Server                                |
-| kubernetes.client.http.response.latency.nanos             | Histograms | 
Measures the statistical distribution of HTTP response latency from the 
Kubernetes API Server                            |
-| kubernetes.client.http.response.`ResponseCode`            | Meter      | 
Tracking the rates of HTTP response based on response code from the Kubernetes 
API Server                                |
-| kubernetes.client.http.request.`RequestMethod`            | Meter      | 
Tracking the rates of HTTP request based type of method to the Kubernetes API 
Server                                     |
-| kubernetes.client.http.response.1xx                       | Meter      | 
Tracking the rates of HTTP Code 1xx responses (informational) received from the 
Kubernetes API Server per response code. |
-| kubernetes.client.http.response.2xx                       | Meter      | 
Tracking the rates of HTTP Code 2xx responses (success) received from the 
Kubernetes API Server per response code.       |
-| kubernetes.client.http.response.3xx                       | Meter      | 
Tracking the rates of HTTP Code 3xx responses (redirection) received from the 
Kubernetes API Server per response code.   |
-| kubernetes.client.http.response.4xx                       | Meter      | 
Tracking the rates of HTTP Code 4xx responses (client error) received from the 
Kubernetes API Server per response code.  |
-| kubernetes.client.http.response.5xx                       | Meter      | 
Tracking the rates of HTTP Code 5xx responses (server error) received from the 
Kubernetes API Server per response code.  |
-| kubernetes.client.`ResourceName`.`Method`                 | Meter      | 
Tracking the rates of HTTP request for a combination of one Kubernetes resource 
and one http method                      |
-| kubernetes.client.`NamespaceName`.`ResourceName`.`Method` | Meter      | 
Tracking the rates of HTTP request for a combination of one namespace-scoped 
Kubernetes resource and one http method     |
+| Metrics Name                                              | Type       | 
Description                                                                     
                                                                                
                                                          |
+|-----------------------------------------------------------|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| kubernetes.client.http.request                            | Meter      | 
Tracking the rates of HTTP request sent to the Kubernetes API Server            
                                                                                
                                                          |
+| kubernetes.client.http.response                           | Meter      | 
Tracking the rates of HTTP response from the Kubernetes API Server              
                                                                                
                                                          |
+| kubernetes.client.failed                                  | Meter      | 
Tracking the rates of HTTP requests which have no response, or an error 
response, from the Kubernetes API Server                                        
                                                                  |
+| kubernetes.client.http.response.latency.nanos             | Histograms | 
Measures the statistical distribution of HTTP response latency from the 
Kubernetes API Server                                                           
                                                                  |
+| kubernetes.client.http.response.`ResponseCode`            | Meter      | 
Tracking the rates of HTTP response based on response code from the Kubernetes 
API Server                                                                      
                                                           |
+| kubernetes.client.http.request.`requestmethod`            | Meter      | 
Tracking the rates of HTTP request based type of method (in lower case, e.g. 
`get`) to the Kubernetes API Server                                             
                                                             |
+| kubernetes.client.1xx                                     | Meter      | 
Tracking the rates of HTTP Code 1xx responses (informational) received from the 
Kubernetes API Server. Only available when 
`spark.kubernetes.operator.metrics.clientMetricsGroupByResponseCodeEnabled` is 
true (default). |
+| kubernetes.client.2xx                                     | Meter      | 
Tracking the rates of HTTP Code 2xx responses (success) received from the 
Kubernetes API Server. Only available when 
`spark.kubernetes.operator.metrics.clientMetricsGroupByResponseCodeEnabled` is 
true (default).       |
+| kubernetes.client.3xx                                     | Meter      | 
Tracking the rates of HTTP Code 3xx responses (redirection) received from the 
Kubernetes API Server. Only available when 
`spark.kubernetes.operator.metrics.clientMetricsGroupByResponseCodeEnabled` is 
true (default).   |
+| kubernetes.client.4xx                                     | Meter      | 
Tracking the rates of HTTP Code 4xx responses (client error) received from the 
Kubernetes API Server. Only available when 
`spark.kubernetes.operator.metrics.clientMetricsGroupByResponseCodeEnabled` is 
true (default).  |
+| kubernetes.client.5xx                                     | Meter      | 
Tracking the rates of HTTP Code 5xx responses (server error) received from the 
Kubernetes API Server. Only available when 
`spark.kubernetes.operator.metrics.clientMetricsGroupByResponseCodeEnabled` is 
true (default).  |
+| kubernetes.client.`resourcename`.`method`                 | Meter      | 
Tracking the rates of HTTP request for a combination of one Kubernetes resource 
and one http method (both in lower case, e.g. `configmaps.get`)                 
                                                          |

Review Comment:
   **Finding 1.** This row only counts a request whose path names a namespace. 
`updateRequestMetrics` marks it only when `parseNamespaceScopedResource` finds 
`namespaces` in the path (`KubernetesMetricsInterceptor.java:173-181`). So two 
kinds of request are left out:
   
   - **A cluster-scoped resource.** In a probe, a GET of `/api/v1/nodes/n-1` 
created no `nodes.get` meter.
   - **A list or watch across all namespaces.** An example is 
`/apis/spark.apache.org/v1/sparkapplications`, which is what the informers 
request with `watchedNamespaces=*`.
   
   Both are still counted in `kubernetes.client.http.request` and 
`kubernetes.client.http.request.get`. The next row already says 
"namespace-scoped", so without it this one reads as if it covered every request.
   
   ```suggestion
   | kubernetes.client.`resourcename`.`method`                 | Meter      | 
Tracking the rates of HTTP request for a combination of one Kubernetes resource 
and one http method (both in lower case, e.g. `configmaps.get`), only for a 
request whose path names a namespace                          |
   ```
   



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