On Fri, Dec 14, 2018 at 7:58 AM tucky kong <[email protected]> wrote:
> Hello,
>
> I try to write an extension to export Prometheus metrics with the
> Promtheus Java client library and
> I am stuck with the exporting part[1].
>
> I need my Guacamole extension to serve a `MetricsServlet` which extends an
> `HttpServlet`[2].
>
> To do so, I tried to extend extend a `ServletModule` that implements the
> Listener interface with an override of the `configureServlets` method which
> contains the following code:
>
> ```
> serve("/metrics").with(new MetricsServlet());
> ```
>
> Unfortunately, the `configureServlets` method doesn't seems to be called
> and Tomcat does not find the `/metrics` path.
>
A ServletModule will not be automatically loaded by Guacamole. The API that
Guacamole provides for extensions to add their own endpoints, etc.
leverages JAX-RS:
http://guacamole.apache.org/doc/gug/guacamole-ext.html#ext-rest-resources
http://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/AuthenticationProvider.html#getResource--
http://guacamole.apache.org/doc/guacamole-ext/org/apache/guacamole/net/auth/UserContext.html#getResource--
Does the library you're trying to use provide support for JAX-RS? If so,
you could expose a REST resource that serves what you're looking for. That
would be supported by the Guacamole extension API.
- Mike