afs edited a comment on issue #534: [WIP] Proof of concept for prometheus 
endpoint
URL: https://github.com/apache/jena/pull/534#issuecomment-475252662
 
 
   This is looking good.  I have it working in Fuseki Full (webapp form) and in 
Fuseki Main (the more configurable servlet form) - details for running in 
Fuseki Main below.
   
   #### Configuration
   
   Something we have to think about carefully is using `ServiceLoader`. Jena 
already has an [init 
mechanism](https://jena.apache.org/documentation/notes/system-initialization.html)
 and it allows controlling the order of initialization. It is quite simple - 
there is an `init()` method which might be a limitation.
   
   `ActionPrometheus` could use this to wire in a function lambda to call it's 
`perform()` into a registry.
   
   I don't know at the moment which of a "different ServiceLoader" or "single 
ServiceLoader" is better.
   
   #### Naming
   
   Rather than hide under `/$/extras/` I think I prefer `/$/metrics/` or 
something else to cover just statistics reporting. This is a significant 
functionality, not to be hidden under "extras".
   
   #### Dispatch
   
   The `ActionExtras.perform` could dispatch on the final component of the URI. 
 No fixed string!
   
   It might even be better to look for the dispatch string in 
`init(ServletConfig)` to find the prefix for this servlet instance.
   
   #### HTTP MIME Type
   
   The HTTP return is set as `application/json;charset=utf-8` but it isn't 
JSON. If there isn't a specific MIME type, then `text/plain;charset=utf-8` 
would be better (?).
   
   #### jena-prometheus jar
   
   The shaded JAR has got slf4j classes in it. I don't think they are needed. 
Can they be excluded
   ? either in the POM or in the shader. Maybe it is an effect of the 
`<scope>provided</scope>`.
   
   
[jena-fuseki2/jena-fuseki-server/pom.xml](https://github.com/apache/jena/blob/master/jena-fuseki2/jena-fuseki-server/pom.xml)
 has an example of shading Jena including license control.
   
   #### Licensing
   
   `org.hdrhistogram` and  `org.latencyutils` are 2-clause BSD license and we a 
shipping them in shared artifacts so the acknowledge clause applies.   No 
problem, just a task to do. The right LICENSE and NOTICE need to end up in the 
shaded jar.
   
   #### Fuseki Main example
   
   Illustration of running in `FusekiMain`:
   
       public static void mainServer(String ... a) {
           FusekiLogging.setLogging();
           FusekiServer server = FusekiServer.create()
               .add("/ds", DatasetGraphFactory.createTxnMem())
               .port(3030)
               .verbose(true)
               .addServlet("/$/extras/*", new ActionExtras())
               .build();
           
           try { server.start().join(); }
           finally { server.stop(); }
       }
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to