-
Notifications
You must be signed in to change notification settings - Fork 36
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
Added support for custom exception handler for VertxPrometheusOptions… #214
Conversation
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.
Thanks for your proposal. Instead of adding an exception handler to options, it would be better to create a class that provides a request handler (similar to the scraping handler for vert.x web).
This way, the user can create the HTTP server without implementing the request handler and having full control on the server behavior.
Hi @tsegismont , Created a PrometheusRequestHandler class to manage Prometheus requests. and User can get the flexibility to create their own httpServer without implementing the request handler Thanks |
Can you please sign the Eclipse Contributor Agreement and then, using the same Git author/user email, sign-off the commit? |
Thanks @tsegismont , revalidated the commit by signing off the agreement. |
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.
Thanks for the updates @swamymavuri
public class PrometheusRequestHandler implements Handler<HttpServerRequest> { | ||
|
||
private final PrometheusMeterRegistry registry; | ||
private final VertxPrometheusOptions options; |
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.
Can you change this to a String
field that stores the embedded server endpoint? We don't need all of the options.
|
||
@Override | ||
public void handle(HttpServerRequest request) { | ||
if (options.getEmbeddedServerEndpoint().equals(request.path())) { |
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.
Here you can simplify the condition to use the string field
* | ||
* @author Swamy Mavuri | ||
*/ | ||
public class PrometheusRequestHandler implements Handler<HttpServerRequest> { |
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.
Can you please create an interface annotated with @VertxGen
like the PrometheusScrapingHandler
@VertxGen
public interface PrometheusScrapingHandler {
/**
* Creates a Vert.x Web {@link io.vertx.ext.web.Route} handler for Prometheus metrics scraping.
* The default backend registry is used.
*
* @return a {@link io.vertx.ext.web.Route} handler for the default backend registry
* @see BackendRegistries#getDefaultNow()
*/
static Handler<RoutingContext> create() {
return new PrometheusScrapingHandlerImpl();
}
If you do this, we will automatically have generated files for RxJava, Mutiny, ...etc
Can you please also change the PR and issue titles and descriptions to reflect the new direction? |
… (#213)
Motivation:
Explain here the context, and why you're making that change, what is the problem you're trying to solve.
Conformance:
Your commits should be signed and you should have signed the Eclipse Contributor Agreement as explained in https://github.com/eclipse/vert.x/blob/master/CONTRIBUTING.md
Please also make sure you adhere to the code style guidelines: https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines