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

Combining metrics annotations leads to exception #2991

Closed
schoeffm opened this issue Jul 26, 2018 · 1 comment
Closed

Combining metrics annotations leads to exception #2991

schoeffm opened this issue Jul 26, 2018 · 1 comment

Comments

@schoeffm
Copy link

schoeffm commented Jul 26, 2018

Description


Annotating a managed bean with more than one metrics annotation (i.e. @Metered and @Timed) causes a ClassCastException.

Expected Outcome

My expectation was to have both types registered - one metrics-measurement for each annotation.

Current Outcome

Well, when calling the annotated bean this leads to a ClassCastException.

Steps to reproduce (Only for bug reports)

Take the attached archive - unpack it - build and start it using:

mvn clean install && docker-compose build && docker-compose up -d

After the app was started, hit the defined endpoint:

curl http://localhost:8080/metricstest/api/ping
[metricstest.zip](https://github.com/payara/Payara/files/2231701/metricstest.zip)

Samples

import org.eclipse.microprofile.metrics.annotation.Metered;
import org.eclipse.microprofile.metrics.annotation.Timed;

import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;

@ApplicationScoped
@Path("ping")
public class PingResource {

    @GET
    @Metered
    @Timed
    public String ping() {
        return "Hello World";
    }
}

Context (Optional)

What I wanted to accomplish is to measure different aspects of a method execution - thus I've placed two types of metrics-annotations on top of a REST-Resource to get

  1. it's execution time
  2. the number of calls during app-runtim

Environment

  • Payara Version: 5.182, 4.181
  • Edition: Micro
  • JDK Version: 8 u152 - OpenJDK
  • Operating System: Linux / Mac
  • Database: no DB involved
@jGauravGupta
Copy link
Contributor

Issue already fixed in master PR #2886

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

No branches or pull requests

2 participants