HDDS-16019. Publish httpfs gateway metrics to Prometheus via /prom endpoint - #10918
HDDS-16019. Publish httpfs gateway metrics to Prometheus via /prom endpoint#10918arunk-kumar wants to merge 1 commit into
Conversation
…dpoint Extract the Prometheus servlet wiring from BaseHttpServer into a public static helper (addPrometheusEndpoint) so HttpFSServerWebServer can expose /prom without extending BaseHttpServer. Wire the helper and the DefaultMetricsSystem lifecycle in HttpFSServerWebServer, gated by hdds.prometheus.endpoint.enabled.
|
did you check that Prometheus actually collect metrics from httpfs instances? |
|
+1 to the above. Let's at least manually verify that prometheus is showing existing httpfs metrics in the docker environment (Add monitoring.yaml to your docker compose configuration). If possible it would be good to add a test case to the acceptance tests as well that Also, can you update the target branch to |
|
Closing to reopen from the correct master-based branch (HDDS-16019-httpfs-prom-endpoint-master) as per the discussion. New PR coming shortly. |
|
Updated PR: #10945 |
What changes were proposed in this pull request?
HttpFSServerWebServerbuilds anHttpServer2directly rather than extendingBaseHttpServer, so it had no/promendpoint and could not be scraped by Prometheus. This meant httpfs metrics were invisible to any Prometheus-based monitoring, and httpfs was absent from Grafana dashboards that group by component.Changes:
Extract the Prometheus servlet wiring from
BaseHttpServerinto a newpublic statichelper methodaddPrometheusEndpoint(HttpServer2, ConfigurationSource, String). This lives in the same package asBaseHttpServerso it retains access to the package-privatePROMETHEUS_SINKconstant andHttpServer2.getWebAppContext().Refactor
BaseHttpServerto call the helper — no behaviour change for existing services.Wire the helper into
HttpFSServerWebServer: calladdPrometheusEndpointin the constructor (afterHttpServer2is built), register the returned sink withDefaultMetricsSysteminstart(), and unregister instop(). Gated byhdds.prometheus.endpoint.enabled(default: true), matching the behaviour of other services.The security model is preserved: if
hdds.prometheus.endpoint.tokenis set,/promis added as an internal servlet (token-based auth, SPNEGO bypassed); otherwise it is a regular servlet protected by the server's auth filter.This is a prerequisite for HDDS-15858 (add httpfs to the ZDU Rolling Upgrade Grafana dashboard), which will add the httpfs scrape target and build-info metrics on top.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16019
Prereq for: HDDS-15858
Epic: HDDS-14496 (Zero Downtime Upgrade)
How was this patch tested?
Local verification against
upstream/HDDS-14496-zdu:mvn -pl :ozone-httpfsgateway,:hdds-server-framework -am install -DskipTests -DskipShade -DskipRecon -DskipDocs— builds clean.mvn -pl :ozone-httpfsgateway,:hdds-server-framework checkstyle:check— 0 violations on both modules.mvn -pl :ozone-httpfsgateway,:hdds-server-framework apache-rat:check— 0 unapproved licences.mvn -pl :ozone-httpfsgateway,:hdds-server-framework test— 573 tests, 0 failures (1 pre-existing skip inTestNetworkTopologyImpl).TestBaseHttpServerandTestPrometheusServletAuthorizationinhdds-server-frameworkpass without modification, confirming the refactor does not change existing behaviour.