-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Enable more MongoDB Micrometer metrics #44999
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.quarkus.mongodb.metrics; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import io.micrometer.core.instrument.MeterRegistry; | ||
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener; | ||
|
||
public class MicrometerCommandListener extends MongoMetricsCommandListener { | ||
@Inject | ||
public MicrometerCommandListener(MeterRegistry registry) { | ||
super(registry); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
import com.mongodb.event.ConnectionPoolListener; | ||
|
||
import io.quarkus.arc.Arc; | ||
import io.quarkus.mongodb.metrics.MicrometerCommandListener; | ||
import io.quarkus.mongodb.metrics.MicrometerConnectionPoolListener; | ||
import io.quarkus.mongodb.metrics.MongoMetricsConnectionPoolListener; | ||
import io.quarkus.mongodb.reactive.ReactiveMongoClient; | ||
|
@@ -99,6 +100,10 @@ public ConnectionPoolListener get() { | |
}; | ||
} | ||
|
||
public static String getMicrometerCommandListenerClassName() { | ||
return MicrometerCommandListener.class.getName(); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this is used in a single place you can directly add the class name at the use site. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
micrometer wasn't on class path in deployment module, that's why I've put it there. I'll add optional dependency and move the code to the deployment |
||
public Supplier<ConnectionPoolListener> createMPMetricsConnectionPoolListener() { | ||
return new Supplier<ConnectionPoolListener>() { | ||
@Override | ||
|
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.
Yeah, I wouldn't do that. Even if it doesn't complain right now, that's certainly something that could break later.
What you need to do is change the method to return
void
and inject aBuildProducer<AdditionalIndexedClassesBuildItem> additionalIndexedClasses
and call theproduce()
method when it makes sense (andreturn;
if you want to exit early).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.
@gsmet I've adjusted the code as you requested. Thanks!