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

SmallRye Metrics - @Gauge methods analyzed in MetricsInterceptor should be registered for reflection #6993

Closed
mkouba opened this issue Feb 4, 2020 · 2 comments · Fixed by #7016
Assignees
Labels
area/smallrye kind/bug Something isn't working
Milestone

Comments

@mkouba
Copy link
Contributor

mkouba commented Feb 4, 2020

Describe the bug
MetricsInterceptor does not see the methods annotated with @Gauge if they're not registered for reflection by another extension or annotated with @RegisterForReflection.

Expected behavior
Methods are registered automatically.

Actual behavior
Methods are not registered automatically. MetricsInterceptor does not register a gauge method. No error or warning message.

To Reproduce
Steps to reproduce the behavior:

  1. Add the following bean class to the microprofile-metrics-quickstart
  2. Build the native image
  3. Run the image - you should see the STARTUP message in the log but the gauge is not listed on http://localhost:8080/metrics/application
@ApplicationScoped
public class DummyGauge {

    void init(@Observes StartupEvent event) {
       System.out.println("STARTUP!");
    }

    @Gauge(name = "dummyGauge", unit = MetricUnits.NONE)
    public Long dummyGauge() {
        return 42l;
    }
}

Workaround
Annotated the class with @RegisterForReflection.

@mkouba mkouba added kind/bug Something isn't working area/smallrye labels Feb 4, 2020
@geoand
Copy link
Contributor

geoand commented Feb 4, 2020

Will this also be solved by #6989?

@mkouba
Copy link
Contributor Author

mkouba commented Feb 5, 2020

Nope, that's a different issue. This registration must be perfomed in the SM Metrics extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/smallrye kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants