-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CXF-8213] Add Micrometer metric support for JAX-WS #642
Conversation
.../autoconfigure/src/main/java/org/apache/cxf/spring/boot/autoconfigure/MetricsProperties.java
Outdated
Show resolved
Hide resolved
.../org/apache/cxf/spring/boot/autoconfigure/micrometer/MicrometerMetricsAutoConfiguration.java
Show resolved
Hide resolved
.../org/apache/cxf/spring/boot/autoconfigure/micrometer/MicrometerMetricsAutoConfiguration.java
Outdated
Show resolved
Hide resolved
How would adding support to JAX-RS look like? Could we reuse parts of the code? |
# Conflicts: # systests/spring-boot/pom.xml
In theoretically yes you can. But I have a lack of knowledge about JAX-RS. Due to this I don't want to add any code related to that. |
@junhuhdev The idea is to shape this PR so the foundation is ready for JAX-RS (very likely without introducing JAX-RS support directly as per discussion with @shark300 on the ticket). I should be back on it in a few days to finish up the review. |
Ok thanks looks promising. Looking forward to testing this implementation. Btw is support JAX-RS on the roadmap? |
@junhuhdev certainly, https://issues.apache.org/jira/browse/CXF-8252 |
# Conflicts: # integration/spring-boot/starter-jaxws/pom.xml
.../spring/boot/autoconfigure/micrometer/provider/jaxws/SpringBasedTimedAnnotationProvider.java
Outdated
Show resolved
Hide resolved
...est/java/org/apache/cxf/spring/boot/autoconfigure/micrometer/provider/jaxws/CustomTimed.java
Outdated
Show resolved
Hide resolved
.../org/apache/cxf/spring/boot/autoconfigure/micrometer/MicrometerMetricsAutoConfiguration.java
Show resolved
Hide resolved
...atures/metrics/src/main/java/org/apache/cxf/metrics/micrometer/provider/jaxws/JaxwsTags.java
Show resolved
Hide resolved
...etrics/src/main/java/org/apache/cxf/metrics/micrometer/provider/jaxws/JaxwsTagsProvider.java
Outdated
Show resolved
Hide resolved
# Conflicts: # parent/pom.xml # systests/spring-boot/pom.xml
...atures/metrics/src/main/java/org/apache/cxf/metrics/micrometer/MicrometerMetricsContext.java
Outdated
Show resolved
Hide resolved
...atures/metrics/src/main/java/org/apache/cxf/metrics/micrometer/MicrometerMetricsContext.java
Show resolved
Hide resolved
@shark300 thanks a lot for working on that, it looks great, I just have a few comments, looks very good otherwise. |
@reta Thank you, and I'm sorry because fixing review comments takes much time. |
@shark300 not a problem at all, this is really nice feature, your contribution is greatly appreciated. |
@reta I'm not familiar with this project, but I have some questions: who is responsible for documentation update and squashing commits? |
@shark300 maintainers usually squash commits when merging to master (and sometimes cherry-pick to maintenance branches), the documentation is also updated by maintainers. |
@shark300 I have no outstanding comments or concerns left, I just need to take some time to verify / play with this feature in different scenarios before merging it in, sounds good? Thanks again for your work. |
@reta Thank you for your work too :) |
.../org/apache/cxf/spring/boot/autoconfigure/micrometer/MicrometerMetricsAutoConfiguration.java
Outdated
Show resolved
Hide resolved
@Override | ||
public Set<Timed> getTimedAnnotations(Exchange ex) { | ||
HandlerMethod handlerMethod = new HandlerMethod(ex); | ||
return timedAnnotationCache.computeIfAbsent(handlerMethod, method -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, a few issues I have run into with this method.
- The
computeIfAbsent
is known to introduce unnecessary locking on JDK8 in case when entry already exists (see please https://bugs.openjdk.java.net/browse/JDK-8161372). Since we are going to callgetTimedAnnotations
for each invocation, it is better to avoid these kind if issues if possible. - We allocate the empty sets every time for each method that does not have
@Timed
annotation, we could useCollections.emptySet()
singleton instead.
The suggested modifications are below, hope they make sense (the same would apply to DefaultTimedAnnotationProvider
)
public Set<Timed> getTimedAnnotations(Exchange ex) {
HandlerMethod handlerMethod = new HandlerMethod(ex);
final Set<Timed> exists = timedAnnotationCache.get(handlerMethod);
if (exists != null) {
return exists;
}
return timedAnnotationCache.computeIfAbsent(handlerMethod, method -> {
Set<Timed> timed = findTimedAnnotations(method.getMethod());
if (timed.isEmpty()) {
timed = findTimedAnnotations(method.getBeanType());
}
return timed.isEmpty() ? Collections.emptySet() : timed;;
});
}
PS: I am fine doing these changes myself after merge as well, please let me know your preferences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@shark300 may I ask you please to:
We should be able to merge when checks + checkstyle are "green". I also created the documentation template (https://cwiki.apache.org/confluence/display/CXF20DOC/Micrometer) and would ask your help please to review once ready (if you don't mind). |
@reta |
…)" This reverts commit 2e3631a.
* [CXF-8213] Add Micrometer metric support for JAX-WS * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed compile error * [CXF-8213] Fixed failing test * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Remove Guava from Metrics feature * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed Checkstyle * [CXF-8213] Fixed performance issues Co-authored-by: Attila Hajdu <attila.hajdu@vodafone.com>
* [CXF-8213] Add Micrometer metric support for JAX-WS * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed compile error * [CXF-8213] Fixed failing test * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Remove Guava from Metrics feature * [CXF-8213] Fixed review comments * [CXF-8213] Fixed review comments * [CXF-8213] Fixed Checkstyle * [CXF-8213] Fixed performance issues Co-authored-by: Attila Hajdu <attila.hajdu@vodafone.com> (cherry picked from commit 6131b13)
No description provided.