Skip to content

Add the ability to count requests #1298

Open

Description

@thboileau

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

Activity

  1. apirom9 commented on Oct 22, 2017

    @apirom9

    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.

  2. Tembrel commented on Jan 30, 2018

    @Tembrel
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions