hanahmily opened a new pull request, #1164:
URL: https://github.com/apache/skywalking-banyandb/pull/1164

   ### What
   
   Introduces the `pkg/meter` observability subsystem into the lifecycle 
(tier-migration) command, under two constraints:
   
   1. **Prometheus reuses the lifecycle's existing HTTP port.** A 
listener-suppressed mode on the shared `metricService` 
(`NewMetricServiceWithoutListener` + a `PrometheusHandlerProvider` accessor) 
lets the lifecycle mount `/metrics` on its existing chi router (default 
`:17915`) instead of opening the separate `:2121` observability listener. The 
FODC agent already scrapes `:17915`, so this needs no deployment change. 
`Validate()` still fails fast on an empty listener address for the **default** 
constructor, so standalone/data/liaison are unaffected.
   
   2. **Native mode writes to the co-located data node.** The lifecycle runs as 
a sidecar beside a data node; native `_monitoring` measure writes are routed to 
`127.0.0.1:17912` via a `pub` client that registers the local node with 
`ROLE_DATA` (required — the publisher role gate silently drops role-less nodes) 
plus a keeper that re-dials on loss. Native is opt-in; the default mode stays 
`prometheus`.
   
   The real `MetricsRegistry` also replaces `BypassRegistry` in the lifecycle 
service, so the existing `protector` memory metrics now emit, and a 
`banyandb_lifecycle_cycles_total` counter is added.
   
   ### Why
   
   The lifecycle migration sidecar previously exposed no metrics — its HTTP 
port served only the cluster-state `/api`, leaving the migration layer 
unobservable.
   
   ### Changes
   
   - `banyand/observability`: new `PrometheusHandlerProvider` interface; 
`NewMetricServiceWithoutListener` + listener-suppression in `Serve()` (releases 
the closer slot, no socket bound); `routeTableHandler` nil-guard.
   - `banyand/backup/lifecycle`: wire the registry into `omr`, mount `/metrics` 
on the existing server, local-node native pipeline (`pub` + `pickFirstSelector` 
+ cluster node registry) with a keeper, and the proof counter.
   - Tests: fail-fast / listener-suppression / handler-serving (observability); 
role-gate, `/metrics`-vs-`/api` routing, and local-node metadata (lifecycle, 
queue/pub).
   
   ### Verification
   
   - `make lint` (golangci-lint + revive + import-boundaries) and `make check` 
clean; touched-package tests and `go build ./...` pass.
   - Verified live on the showcase cluster: `/metrics` on `:17915` returns 
Prometheus exposition (73 series), and the FODC agent scrapes it stamped 
`container_name="lifecycle"`.
   
   ### Follow-up (out of scope)
   
   The separate `banyandb_lifecycle_migration_*` pub-family series consumes the 
`observability.Factory` this PR makes available; it changes 
`pub.NewWithoutMetadata`'s signature and lands separately.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to