mirror of
https://github.com/prometheus/prometheus.git
synced 2026-06-11 01:20:07 -04:00
The azureClient struct held the armcompute and armnetwork SDK clients as concrete fields while satisfying the client interface. Once such a client is reachable through an interface, Go's linker conservatively retains every exported method of the concrete type plus the entire (de)serializer graph those operations drag in, even though discovery calls only a handful of them. Wrap each SDK client in a small adapter that captures only the operations discovery uses as method-value closures, and box the adapters instead of the raw clients. The concrete clients then live only inside closure contexts, which reflection cannot traverse, so dead-code elimination drops the unused operations. This drops the retained operations per client from ~60 down to the 2-3 actually used (UsedInIface markers go from 244+66 to 0), shrinking both the prometheus and promtool binaries by ~3.2 MB each. No functional or API change. Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| azure.go | ||
| azure_test.go | ||
| metrics.go | ||