afedulov opened a new pull request #11195: [FLINK-16222][runtime] Use plugins 
mechanism for initializing MetricReporters
URL: https://github.com/apache/flink/pull/11195
 
 
   ## What is the purpose of the change
   
   [FLINK-11952](https://issues.apache.org/jira/browse/FLINK-11952) introduced 
Plugins mechanism into Flink. This PR makes it possible to benefit from using 
this new functionality during the MetricReporters initialization. Instead of 
placing MetricReporters JARs into`/libs`, it is now additionally possible (and 
encouraged) to convert them into plugins and use the `/plugins` folder for 
initialization via independent plugin classloaders.
   
   Note that to enable this functionality, a bounded type of Plugin was removed 
from the PluginLoader/PluginManager methods. This removal did not affect any 
existing functionality, including FileSystems initialization. The adjustment 
was required for the following reason: `MetricReporter` interface, which is 
located in the `flink-metrics-core` module is currently not a `Plugin`. 
`Plugin` interface is located in `flink-core` and this module already has a 
depency on `flink-metrics-core`. This makes in impossible to mark 
`MetricReporter` as  `Plugin` without introducing a circular dependency. An  
alternative approach could be extraction of the whole plugin classloading 
functionality out of `flink-core` into a separate module.
   
   Another important consideration - current `PluginClassLoader` implementation 
uses parent-first initialization for classes, which start with Flink-native 
package prefixes, such as *org.apache.flink.*. Currently, metrics reporters 
shipped with Flink all have the same package prefix. This leads to the 
following situation: if there is a version of `PluginMetricFactory` for a 
particular reporter found in the /lib folder, JARs for this reporter in 
/plugins directory will effectively be ignored. The opposite priority might 
actually be desirable to improve user's experience when transitioning to 
plugins-based metrics initialization approach.
   
   ## Brief change log
   
     - `PluginManager`, already created for `FileSystems` initialization, is 
propagated from all Flink entrypoints into metrics reporters initializer
     - Reporters initializer (`ReporterSetup`) combines initialization via 
existing `ServiceLoader` approach with the new approach of loading plugins
   - `PrometheusReporter` is adjusted to be compatible with the new plugins 
mechanism. Proper functioning is verified with the end-to-end tests
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
     - Added integration tests for end-to-end tests
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes)
     - If yes, how is the feature documented? (not documented)
   
   

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

Reply via email to