AMBARI-26661. Refresh telemetry assignments on component state transitions (#4222)

TelemetryHolder only refreshes a host's telemetry assignment in response to
ServiceComponentInstalledEvent, which ServiceComponentHostImpl publishes from
its constructor while the host component row is first persisted with desired
state INIT. TelemetryAssignmentCompiler skips any component that is not in an
installed state - and INIT is not one of them - so the assignment compiled at
that moment never contains component targets.

Nothing recompiles it on the normal install/start path either: handleEvent(),
which processes the real state transitions, refreshes HostLevelParamsHolder but
never TelemetryHolder. A freshly installed cluster therefore gets no VMAGENT
component scrape targets until an unrelated cluster config change or an
ambari-server restart forces a recompile.

Refresh TelemetryHolder from handleEvent(), in the same block that already
publishes HostComponentsUpdateEvent on a real status change. TelemetryHolder
.getCurrentData(Long) is widened from protected to public so it is callable
from there, matching how HostLevelParamsHolder already exposes it.

Adds two tests:
- TelemetryAssignmentCompilerTest asserts a component in INIT contributes no
  targets while INSTALLED and STARTED each contribute one, documenting why
  subscribing to ServiceComponentInstalledEvent cannot work.
- ServiceComponentHostTest asserts a real state transition repopulates the
  host's telemetry assignment. The cached assignment is dropped after
  createEvent(), because creating a config publishes ClusterConfigChangedEvent,
  which TelemetryHolder also refreshes on - the same mechanism that masks this
  bug on a real cluster.
4 files changed
tree: ff739a00508a9774f7935238244c631089def558
  1. .github/
  2. ambari-admin/
  3. ambari-agent/
  4. ambari-common/
  5. ambari-funtest/
  6. ambari-metrics/
  7. ambari-project/
  8. ambari-server/
  9. ambari-server-spi/
  10. ambari-serviceadvisor/
  11. ambari-utility/
  12. ambari-views/
  13. ambari-web/
  14. contrib/
  15. dev-support/
  16. docs/
  17. .asf.yaml
  18. .gitattributes
  19. .gitignore
  20. AGENTS.md
  21. install-ambari-python.sh
  22. Jenkinsfile
  23. KEYS
  24. LICENSE.txt
  25. logo.png
  26. MANIFEST.in
  27. NOTICE.txt
  28. pom.xml
  29. pyproject.toml
  30. README.md
  31. requirements-build.in
  32. requirements-build.lock
  33. requirements-tooling.txt
  34. setup.py
  35. start-build-env.sh
  36. version
README.md

Apache Ambari

Build Status license

Apache Ambari is a tool for provisioning, managing, and monitoring Apache Hadoop clusters. Ambari consists of a set of RESTful APIs and a browser-based management interface. Its monitoring stack uses Prometheus-compatible APIs, Ambari Agent exporters, and a bundled VictoriaMetrics storage provider.

The optional Ambari Metrics RPM packages the pinned VictoriaMetrics release used by the default deployment. It replaces the legacy Ambari Metrics System and Ganglia integrations; it is not the former external apache/ambari-metrics project.

Sub-projects

Getting Started

https://cwiki.apache.org/confluence/display/AMBARI/Quick+Start+Guide

Built With

https://cwiki.apache.org/confluence/display/AMBARI/Technology+Stack

Contributing

https://cwiki.apache.org/confluence/display/AMBARI/How+to+Contribute

License

http://ambari.apache.org/license.html