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

Add the ability to count requests #1298

Open
thboileau opened this issue Oct 20, 2017 · 2 comments
Open

Add the ability to count requests #1298

thboileau opened this issue Oct 20, 2017 · 2 comments

Comments

@thboileau
Copy link
Contributor

thboileau commented Oct 20, 2017

cf pull request: #1295 from @apirom9

there is an issue because it adds a dependency on the core module.
Let's discuss how to plug such behavior.
As a side note it is linked with JMX capability which is nice

@apirom9
Copy link

apirom9 commented Oct 22, 2017

I see. May be we can

  • define some interfaces in the core module
  • add some setter for instance of those interfaces in the main class of core module such as org.restlet.Application
  • create new sub module with classes implement those interfaces and we add dependency to 3rd party library (such as dropwizard) to this sub module instead of core module

Just an idea. Sorry, I don't have lot of experience in design java application.

@Tembrel
Copy link
Collaborator

Tembrel commented Jan 30, 2018

Using the application name to register the counter is probably not a good idea, since nothing prevents two applications from sharing a name.

Why not just offer this as a standalone class, possibly in an extension, with one public static method that application writers can use as follows:

public class MyApplication extends Application {
    @Override public Restlet createInboundRoot() {
        Router router = new Router(getContext());
        ... wire things up with router ...
        return Metrics.withCounter(router, "my counter name");
}

I don't see a compelling need for deeper integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants