Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For example, Geode collects metrics in a meter registry, but does not publish them. A developer may wish to publish those metrics via HTTP, using a PrometheusMeterRegistry or similar.

Solution

Give HttpService a public interface for adding endpoints, and make the instance publicly accessible.

Changes and Additions to Public Interfaces

Rename the current HttpService class as InternalHttpService.

Create a new HttpService public interface with methods like:

  • addHandler(String context, Handler handler) to add a simple Jetty handler at the given context.
  • addContextHandler(contextHandler) to add a Jetty context handler.
  • addWebApplication(String appContext, Path warFilePath) to add a war-based web application.

Let InternalHttpService implement HttpService to add the specified endpoints to its Jetty Server.

Add a getHttpService() method to some public API, returning the InternalHttpService instance as an HttpService. (What is an appropriate candidate for this method?)

...

Any existing user extensions that depend on the current internal API to add endpoints will break.

Prior Art

Alternative 1: Create a separate server to serve additional content via HTTP. This consumes an additional port, and requires additional work to allocate the port and configure the separate server to use it.

Alternative 2: Use internal APIs to add web applications and handlers. Any user code that does this will break whenever the internal APIs change.What would be the alternatives to the proposed solution? What would happen if we don’t solve the problem? Why should this proposal be preferred?

FAQ

Answers to questions you’ve commonly been asked after requesting comments for this proposal.

...