mirror of
https://github.com/go-micro/go-micro.git
synced 2026-06-15 19:35:13 +02:00
* feat: add prometheus monitoring wrapper Reintroduces the Prometheus metrics wrapper previously available in the plugins repository, updated for go-micro v5. Exposes request count and latency histograms for handlers, subscribers, and outgoing client calls via NewHandlerWrapper, NewSubscriberWrapper, NewCallWrapper and NewClientWrapper, labelled with service/endpoint/status. Options cover namespace, subsystem, const labels, histogram buckets and a custom registerer; duplicate collectors (e.g. from multiple wrappers sharing the same config) are reused transparently via a cached metrics bundle. Fixes #2893 * fix(registry/etcd): clear lease/register caches on KeepAlive channel closure When the etcd client's long-lived KeepAlive channel closes (e.g. because the lease expired on the server side during a network partition), the previous cleanup only removed the channel bookkeeping. The stale entries in `leases` and `register` caused the next registerNode() heartbeat to hit the "unchanged hash" short-circuit and skip re-registration entirely, so the service permanently disappeared from etcd. Extract the cleanup into handleKeepAliveClosed and also drop the cached lease id and hash so the next heartbeat performs a full Grant+Put and the service recovers within one RegisterInterval. Regression introduced by #2822; fix is symmetric with the existing synchronous KeepAliveOnce recovery path that propagates rpctypes.ErrLeaseNotFound. --------- Co-authored-by: Claude <noreply@anthropic.com>