You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "ffang (via GitHub)" <gi...@apache.org> on 2026/04/01 20:10:45 UTC

[PR] [CXF-9206]Duplicated value of 'cxf.server.requests' metric for JAX RS… [cxf]

ffang opened a new pull request, #3010:
URL: https://github.com/apache/cxf/pull/3010

   … Server


-- 
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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CXF-9206]Duplicated value of 'cxf.server.requests' metric for JAX RS… [cxf]

Posted by "ffang (via GitHub)" <gi...@apache.org>.
ffang commented on code in PR #3010:
URL: https://github.com/apache/cxf/pull/3010#discussion_r3030112338


##########
rt/features/metrics/src/main/java/org/apache/cxf/metrics/micrometer/MicrometerMetricsProvider.java:
##########
@@ -59,15 +59,33 @@ public MicrometerMetricsProvider(MeterRegistry registry,
     /**
      * {@inheritDoc}
      */
+
     @Override
     public MetricsContext createEndpointContext(Endpoint endpoint, boolean asClient, String clientId) {
         if (asClient) {
             return null;
-        } else {
-            return new MicrometerServerMetricsContext(registry, tagsProvider, timedAnnotationProvider, tagsCustomizers,
-                micrometerMetricsProperties.getServerRequestsMetricName(), 
-                micrometerMetricsProperties.isAutoTimeRequests());
         }
+        // For JAX-RS server endpoints, createResourceContext() is invoked per

Review Comment:
   Hi @reta ,
   
   Thanks for the feedback!
   Yes, we can extract the logic and move up to higher layer. This commit https://github.com/apache/cxf/pull/3010/commits/829561775181a620eea05130b4bc048557d30981 also revised existing JaxRs Metrics tests as we don't need to create endpointContext for jaxrs endpoints.
   
   Freeman
   



-- 
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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CXF-9206]Duplicated value of 'cxf.server.requests' metric for JAX RS… [cxf]

Posted by "ffang (via GitHub)" <gi...@apache.org>.
ffang commented on code in PR #3010:
URL: https://github.com/apache/cxf/pull/3010#discussion_r3030112338


##########
rt/features/metrics/src/main/java/org/apache/cxf/metrics/micrometer/MicrometerMetricsProvider.java:
##########
@@ -59,15 +59,33 @@ public MicrometerMetricsProvider(MeterRegistry registry,
     /**
      * {@inheritDoc}
      */
+
     @Override
     public MetricsContext createEndpointContext(Endpoint endpoint, boolean asClient, String clientId) {
         if (asClient) {
             return null;
-        } else {
-            return new MicrometerServerMetricsContext(registry, tagsProvider, timedAnnotationProvider, tagsCustomizers,
-                micrometerMetricsProperties.getServerRequestsMetricName(), 
-                micrometerMetricsProperties.isAutoTimeRequests());
         }
+        // For JAX-RS server endpoints, createResourceContext() is invoked per

Review Comment:
   Hi @reta ,
   
   Thanks for the feedback!
   Yes, we can extract the logic and move up to higher layer. This commit https://github.com/apache/cxf/pull/3010/commits/854e22ef7d6aff4b5003f5eba7a89a83e54bcea8 also revised existing JaxRs Metrics tests as we don't need to create endpointContext for jaxrs endpoints.
   
   Freeman
   



-- 
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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CXF-9206]Duplicated value of 'cxf.server.requests' metric for JAX RS… [cxf]

Posted by "ffang (via GitHub)" <gi...@apache.org>.
ffang commented on code in PR #3010:
URL: https://github.com/apache/cxf/pull/3010#discussion_r3030428053


##########
rt/features/metrics/src/main/java/org/apache/cxf/metrics/micrometer/MicrometerMetricsProvider.java:
##########
@@ -59,15 +59,15 @@ public MicrometerMetricsProvider(MeterRegistry registry,
     /**
      * {@inheritDoc}
      */
+
     @Override
     public MetricsContext createEndpointContext(Endpoint endpoint, boolean asClient, String clientId) {
         if (asClient) {
             return null;
-        } else {
-            return new MicrometerServerMetricsContext(registry, tagsProvider, timedAnnotationProvider, tagsCustomizers,
-                micrometerMetricsProperties.getServerRequestsMetricName(), 
-                micrometerMetricsProperties.isAutoTimeRequests());
         }
+        return new MicrometerServerMetricsContext(registry, tagsProvider, timedAnnotationProvider, tagsCustomizers,

Review Comment:
   Sure, done accordingly, 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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CXF-9206]Duplicated value of 'cxf.server.requests' metric for JAX RS… [cxf]

Posted by "reta (via GitHub)" <gi...@apache.org>.
reta commented on code in PR #3010:
URL: https://github.com/apache/cxf/pull/3010#discussion_r3024721574


##########
rt/features/metrics/src/main/java/org/apache/cxf/metrics/micrometer/MicrometerMetricsProvider.java:
##########
@@ -59,15 +59,33 @@ public MicrometerMetricsProvider(MeterRegistry registry,
     /**
      * {@inheritDoc}
      */
+
     @Override
     public MetricsContext createEndpointContext(Endpoint endpoint, boolean asClient, String clientId) {
         if (asClient) {
             return null;
-        } else {
-            return new MicrometerServerMetricsContext(registry, tagsProvider, timedAnnotationProvider, tagsCustomizers,
-                micrometerMetricsProperties.getServerRequestsMetricName(), 
-                micrometerMetricsProperties.isAutoTimeRequests());
         }
+        // For JAX-RS server endpoints, createResourceContext() is invoked per

Review Comment:
   Thanks @ffang , I am wonderign why `createEndpointContext` is called for JAX-RS endpoints? It looks like we have an issue at a bit higher layer that, not only with MicrometerMetricsProvider, wdyt?



-- 
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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CXF-9206]Duplicated value of 'cxf.server.requests' metric for JAX RS… [cxf]

Posted by "ffang (via GitHub)" <gi...@apache.org>.
ffang merged PR #3010:
URL: https://github.com/apache/cxf/pull/3010


-- 
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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CXF-9206]Duplicated value of 'cxf.server.requests' metric for JAX RS… [cxf]

Posted by "reta (via GitHub)" <gi...@apache.org>.
reta commented on code in PR #3010:
URL: https://github.com/apache/cxf/pull/3010#discussion_r3024721574


##########
rt/features/metrics/src/main/java/org/apache/cxf/metrics/micrometer/MicrometerMetricsProvider.java:
##########
@@ -59,15 +59,33 @@ public MicrometerMetricsProvider(MeterRegistry registry,
     /**
      * {@inheritDoc}
      */
+
     @Override
     public MetricsContext createEndpointContext(Endpoint endpoint, boolean asClient, String clientId) {
         if (asClient) {
             return null;
-        } else {
-            return new MicrometerServerMetricsContext(registry, tagsProvider, timedAnnotationProvider, tagsCustomizers,
-                micrometerMetricsProperties.getServerRequestsMetricName(), 
-                micrometerMetricsProperties.isAutoTimeRequests());
         }
+        // For JAX-RS server endpoints, createResourceContext() is invoked per

Review Comment:
   Thanks @ffang , I am wonderign why `createEndpointContext` is called for JAX-RS endpoints? It looks like we have an issue at a bit higher layer, not only with MicrometerMetricsProvider, wdyt?



-- 
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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CXF-9206]Duplicated value of 'cxf.server.requests' metric for JAX RS… [cxf]

Posted by "reta (via GitHub)" <gi...@apache.org>.
reta commented on code in PR #3010:
URL: https://github.com/apache/cxf/pull/3010#discussion_r3030224631


##########
rt/features/metrics/src/main/java/org/apache/cxf/metrics/micrometer/MicrometerMetricsProvider.java:
##########
@@ -59,15 +59,15 @@ public MicrometerMetricsProvider(MeterRegistry registry,
     /**
      * {@inheritDoc}
      */
+
     @Override
     public MetricsContext createEndpointContext(Endpoint endpoint, boolean asClient, String clientId) {
         if (asClient) {
             return null;
-        } else {
-            return new MicrometerServerMetricsContext(registry, tagsProvider, timedAnnotationProvider, tagsCustomizers,
-                micrometerMetricsProperties.getServerRequestsMetricName(), 
-                micrometerMetricsProperties.isAutoTimeRequests());
         }
+        return new MicrometerServerMetricsContext(registry, tagsProvider, timedAnnotationProvider, tagsCustomizers,

Review Comment:
   Super nit, since there is no functional changes here, could we revert this one? Thank you.



-- 
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: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org