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

Micrometer custom MeterFilter not registered when not declared with @Produces annotation #20703

Closed
baiglin opened this issue Oct 12, 2021 · 6 comments · Fixed by #20727
Closed
Assignees
Labels
area/metrics kind/bug Something isn't working
Milestone

Comments

@baiglin
Copy link

baiglin commented Oct 12, 2021

Describe the bug

Hello,

While tryin to add a custom MeterFilter, I was able to do it following the guide, usin a CDI bean that produces MeterFiler beans.

@Singleton
public class CustomConfiguration {

    @Produces
    @Singleton
    public MeterFilter customMeterFilter() {
        return ...;
    }
}

However, annotating my class with Singleton to make it a bean did not work.

@Singleton
public class CustomMeterFilter implements MeterFilter {

}

I was expecting that no matter the way the bean is declared, it would work, maybe I miss something ?

Expected behavior

Any MeterFilter bean would be added to the injectable MeterRegistry produced by quarkus extension

Actual behavior

Only bean created with @produces annotation are added to the list of MeterFilter

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@baiglin baiglin added the kind/bug Something isn't working label Oct 12, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 12, 2021

/cc @ebullient, @kenfinnigan

@geoand
Copy link
Contributor

geoand commented Oct 12, 2021

Based on the description you have added I would say that can't happen.

However since we have seen a lot of weird things, could you attach a sample project that exhibits the problematic behavior?

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Oct 12, 2021
@baiglin
Copy link
Author

baiglin commented Oct 12, 2021

Yes I am currently creating one smaller than our multi-module project. Thanks

@ebullient
Copy link
Member

If you run in dev mode, was your CustomMeterFilter bean removed?

@baiglin
Copy link
Author

baiglin commented Oct 13, 2021

micrometer_reproducer.zip

Here is a small reproducer with two filters supposed to filter tags, one is working, the other seems not. So it seems I am able to reproduce even with the small project which is good.

@geoand
Copy link
Contributor

geoand commented Oct 13, 2021

Great, thanks!

@geoand geoand removed the triage/needs-reproducer We are waiting for a reproducer. label Oct 13, 2021
@geoand geoand self-assigned this Oct 13, 2021
geoand added a commit to geoand/quarkus that referenced this issue Oct 13, 2021
Arc is intelligent enough to only make a class unremovable
if there is an actual bean of that type. It therefore suffices
to let Arc know which types to make unremovable and not try to emulate
the bean declaration logic

Fixes: quarkusio#20703
geoand added a commit to geoand/quarkus that referenced this issue Oct 13, 2021
Arc is intelligent enough to only make a class unremovable
if there is an actual bean of that type. It therefore suffices
to let Arc know which types to make unremovable and not try to emulate
the bean declaration logic

Fixes: quarkusio#20703
geoand added a commit to geoand/quarkus that referenced this issue Oct 13, 2021
Arc is intelligent enough to only make a class unremovable
if there is an actual bean of that type. It therefore suffices
to let Arc know which types to make unremovable and not try to emulate
the bean declaration logic

Fixes: quarkusio#20703
geoand added a commit to geoand/quarkus that referenced this issue Oct 13, 2021
Arc is intelligent enough to only make a class unremovable
if there is an actual bean of that type. It therefore suffices
to let Arc know which types to make unremovable and not try to emulate
the bean declaration logic

Fixes: quarkusio#20703
geoand added a commit that referenced this issue Oct 13, 2021
Fix Micrometer unremovable bean handling
@quarkus-bot quarkus-bot bot added this to the 2.5 - main milestone Oct 13, 2021
@aloubyansky aloubyansky modified the milestones: 2.5 - main, 2.4.0.Final Oct 18, 2021
aloubyansky pushed a commit to aloubyansky/quarkus that referenced this issue Oct 18, 2021
Arc is intelligent enough to only make a class unremovable
if there is an actual bean of that type. It therefore suffices
to let Arc know which types to make unremovable and not try to emulate
the bean declaration logic

Fixes: quarkusio#20703
(cherry picked from commit 98ea1b5)
@gsmet gsmet modified the milestones: 2.4.0.Final, 2.3.1.Final Oct 18, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 18, 2021
Arc is intelligent enough to only make a class unremovable
if there is an actual bean of that type. It therefore suffices
to let Arc know which types to make unremovable and not try to emulate
the bean declaration logic

Fixes: quarkusio#20703
(cherry picked from commit 98ea1b5)
@gsmet gsmet modified the milestones: 2.3.1.Final, 2.2.4.Final Nov 30, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 1, 2021
Arc is intelligent enough to only make a class unremovable
if there is an actual bean of that type. It therefore suffices
to let Arc know which types to make unremovable and not try to emulate
the bean declaration logic

Fixes: quarkusio#20703
(cherry picked from commit 98ea1b5)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 1, 2021
Arc is intelligent enough to only make a class unremovable
if there is an actual bean of that type. It therefore suffices
to let Arc know which types to make unremovable and not try to emulate
the bean declaration logic

Fixes: quarkusio#20703
(cherry picked from commit 98ea1b5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants