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

Programmatically access registered routes #384

Open
fbiville opened this issue Feb 6, 2017 · 1 comment
Open

Programmatically access registered routes #384

fbiville opened this issue Feb 6, 2017 · 1 comment

Comments

@fbiville
Copy link

fbiville commented Feb 6, 2017

There currently isn't any clean way to access HttpRouter tracked routes.

Context

I am trying to monitor (via our Graphite backend) unrouted requests.
The only way I found was to create a catch-all controller.

Now, I want to use ScalaCheck to check the following invariant: all unrouted routes trigger a counter increment. To that end, I need a programmatic access to the app registered routes (so that mapped routes [except the catch-all one] are not generated).

Expected behavior

I expect some public method exposing a read-only copy of the configured routes, such as:

def registeredRoutes(): Seq[Route]

Actual behavior

Currently, I see only three hacky ways to get that information:

  • create a utility class to extract those routes from HttpRouter in a package com.twitter.finatra
  • use reflection
  • subclass HttpRouter

Steps to reproduce the behavior

N/A

@cacoco
Copy link
Contributor

cacoco commented Feb 6, 2017

@fbiville thanks for the issue. This is currently by design. Why? Because the routes are added to the HttpRouter at a specific point in the startup lifecycle of the server and exposing a method or methods to read them opens the potential for that method to used at the wrong point in the lifecycle potentially leading to undesirable issues.

We have kicked around the idea for programmatic access for a bit but have not decided on a way forward yet. Please stay tuned. Thanks.

@cacoco cacoco added the backlog label Feb 6, 2017
@cacoco cacoco added this to the 20.3.0 milestone Oct 29, 2019
@enbnt enbnt removed their assignment Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants