[ 
https://issues.apache.org/jira/browse/HDDS-16019?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18100036#comment-18100036
 ] 

arun kumar commented on HDDS-16019:
-----------------------------------

One design question before implementing.

Replicating BaseHttpServer's /prom wiring from the httpfs package isn't clean: 
both BaseHttpServer.PROMETHEUS_SINK and HttpServer2.getWebAppContext() are 
package-private (org.apache.hadoop.hdds.server.http). BaseHttpServer sets the 
sink via getWebAppContext().getServletContext().setAttribute(PROMETHEUS_SINK, 
sink), neither of which is reachable from org.apache.ozone.fs.http.server. 
There is a public HttpServer2.setAttribute(), but it sets on the webapp context 
rather than the servlet context PrometheusServlet reads from, so it isn't a 
drop-in.

So rather than widening visibility on several framework internals, I'd lean 
toward extracting the sink + PrometheusServlet wiring into a small shared 
helper in org.apache.hadoop.hdds.server.http, called by both BaseHttpServer and 
HttpFSServerWebServer. Slightly more than a one-liner in BaseHttpServer, but no 
widened API surface and it removes the duplication. The secure-mode guarantees 
(bearer-token internal servlet when a token is set, otherwise behind the auth 
filter) carry over unchanged.

Does that approach sound good, or would you prefer just making the needed 
members public? cc: [~erose] 
cc: 

> Publish httpfs gateway metrics to Prometheus via /prom endpoint
> ---------------------------------------------------------------
>
>                 Key: HDDS-16019
>                 URL: https://issues.apache.org/jira/browse/HDDS-16019
>             Project: Apache Ozone
>          Issue Type: Improvement
>            Reporter: arun kumar
>            Assignee: arun kumar
>            Priority: Major
>
> HttpFSServerWebServer builds an HttpServer2 directly rather than
> extending BaseHttpServer, so unlike OM, SCM, Datanode, S3 Gateway,
> and Recon it does not expose a /prom endpoint. As a result the
> metrics already registered on the httpfs JVM (e.g. HttpFSServerMetrics)
> cannot be scraped by Prometheus, and httpfs is absent from
> compose/ozone/prometheus.yml and from component-grouped Grafana
> dashboards.
>  
> {{Proposed change:}}
>  * Register a PrometheusMetricsSink and add the PrometheusServlet at
> /prom in HttpFSServerWebServer, following the pattern in
> BaseHttpServer (guarded by hdds.prometheus.endpoint.enabled). 
>  * Register the sink with DefaultMetricsSystem on start(), unregister
> on stop().
>  * Ensure /prom respects the same authentication guarantees as the
> other services in secure mode (not exposed unauthenticated).
>  
> Note: BaseHttpServer.PROMETHEUS_SINK is currently package-private;
> exposing /prom from the httpfs package needs either that constant
> made public or the wiring extracted into a shared helper. Open to
> either – will confirm on review.
>  
> This is a prerequisite for HDDS-15858 (build info metrics + ZDU
> dashboard), which will add the httpfs scrape target and build info
> on top once /prom exists.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to