zentol opened a new pull request #8373: [FLINK-11922][metrics] Support MetricReporter factories URL: https://github.com/apache/flink/pull/8373 ## What is the purpose of the change Adds support for `MetricReporter` factories. With this change reporters no longer have to adhere to restrictions imposed by generic instantiation (public no arg constructor, initializing things lazily in open()). Factories are loaded through a `ServiceLoader` in the `ReporterSetup`. A migration to the new `Plugin` mechanism should be trivial. Factories are configured similarly to reporter classes ( `reporter.*.factory.class` instead of `reporter.*.class`). This PR additionally migrates the `JMXReporter` to use factories instead, serving as a sanity-check. ### Backwards-compatibility The existing mechanism for instantiating reporters via reflection still exists for the sake of backwards-compatibility, but is likely to be removed in the future. Reporters may support both factories and reflection , but are neither required nor encouraged to do so. For backwards compatibility reporters may be annotated with `InstantiateViaFactory(String factoryClassName)` to automatically forward reflection-based instantiation attempts to the factory. ## Verifying this change The `ReporterSetupTest` was extended to cover the handling of factory configurations. Added: * JMXReporterFactoryTest Existing tests/E2E tests use (JMX) reporters and thus ensure that * reflection-based reporter still work * (now) out-dated JMX configurations are still honored ## Documentation - Does this pull request introduce a new feature? (yes) - If yes, how is the feature documented? (docs / JavaDocs)
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
