Skip to content
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

Merged
merged 19 commits into from
Oct 21, 2020
Merged

[CXF-8213] Add Micrometer metric support for JAX-WS #642

merged 19 commits into from
Oct 21, 2020

Conversation

shark300
Copy link
Contributor

No description provided.

@shark300 shark300 changed the title [CXF-6738] Add Micrometer metric support for JAX-WS [ CXF-8213] Add Micrometer metric support for JAX-WS Feb 18, 2020
@shark300 shark300 changed the title [ CXF-8213] Add Micrometer metric support for JAX-WS [CXF-8213] Add Micrometer metric support for JAX-WS Feb 18, 2020
@shark300 shark300 requested a review from reta February 18, 2020 11:17
@jhswedeveloper
Copy link

How would adding support to JAX-RS look like? Could we reuse parts of the code?

# Conflicts:
#	systests/spring-boot/pom.xml
@shark300
Copy link
Contributor Author

shark300 commented Mar 27, 2020

How would adding support to JAX-RS look like? Could we reuse parts of the code?

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.

@reta
Copy link
Member

reta commented Mar 27, 2020

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

@jhswedeveloper
Copy link

jhswedeveloper commented Mar 27, 2020

Ok thanks looks promising. Looking forward to testing this implementation.

Btw is support JAX-RS on the roadmap?

@reta
Copy link
Member

reta commented Mar 27, 2020

@junhuhdev certainly, https://issues.apache.org/jira/browse/CXF-8252

# Conflicts:
#	integration/spring-boot/starter-jaxws/pom.xml
# Conflicts:
#	parent/pom.xml
#	systests/spring-boot/pom.xml
@shark300 shark300 requested a review from reta October 16, 2020 07:48
rt/features/metrics/pom.xml Outdated Show resolved Hide resolved
@reta
Copy link
Member

reta commented Oct 17, 2020

@shark300 thanks a lot for working on that, it looks great, I just have a few comments, looks very good otherwise.

@shark300
Copy link
Contributor Author

@reta Thank you, and I'm sorry because fixing review comments takes much time.

@reta
Copy link
Member

reta commented Oct 17, 2020

@shark300 not a problem at all, this is really nice feature, your contribution is greatly appreciated.

@shark300
Copy link
Contributor Author

@reta I'm not familiar with this project, but I have some questions: who is responsible for documentation update and squashing commits?

@reta
Copy link
Member

reta commented Oct 17, 2020

@shark300 maintainers usually squash commits when merging to master (and sometimes cherry-pick to maintenance branches), the documentation is also updated by maintainers.

@reta
Copy link
Member

reta commented Oct 17, 2020

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

@shark300
Copy link
Contributor Author

@reta Thank you for your work too :)

@Override
public Set<Timed> getTimedAnnotations(Exchange ex) {
HandlerMethod handlerMethod = new HandlerMethod(ex);
return timedAnnotationCache.computeIfAbsent(handlerMethod, method -> {
Copy link
Member

@reta reta Oct 20, 2020

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.

  1. 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 call getTimedAnnotations for each invocation, it is better to avoid these kind if issues if possible.
  2. We allocate the empty sets every time for each method that does not have @Timed annotation, we could use Collections.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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@reta
Copy link
Member

reta commented Oct 21, 2020

@shark300 may I ask you please to:

  1. Merge with latest master (seems like some checks are failing, CodeQL / Analyze (java))
  2. Run mvn clean verify -Dmaven.test.skip=true -DskipITs=true on this PR, there are some checkstyle violations (it should be covered by Jenkins job but it seems like it was not run for some reasons).

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

@shark300
Copy link
Contributor Author

@reta
PMD and Checkstyle is OK locally.

@reta reta merged commit 2e3631a into apache:master Oct 21, 2020
davidkarlsen added a commit to davidkarlsen/cxf that referenced this pull request Oct 21, 2020
reta pushed a commit that referenced this pull request Oct 22, 2020
* [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>
rnetuka pushed a commit to rnetuka/cxf that referenced this pull request Oct 3, 2022
* [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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants