Cameron Lee created SAMZA-2671: ---------------------------------- Summary: Clean up how Samza wires metrics and handles lifecycle of metrics objects Key: SAMZA-2671 URL: https://issues.apache.org/jira/browse/SAMZA-2671 Project: Samza Issue Type: Improvement Reporter: Cameron Lee
There is some opportunity for improvement in how Samza code handles metrics: # Use more dependency injection: There are multiple places where metrics registries (see "MetricsRegistryMap" constructor) and metrics reporters (see "MetricsReporterLoader.getMetricsReporters") get created. Ideally, this should not be necessary. # Clean up metrics registration: "MetricsReporter.register" gets called in too many places, so it is hard to track when it is happening. # Define ordering for "MetricsReporter.register" and "MetricsReporter.start": It looks like there is no contract on the ordering of "MetricsReporter.register" and "MetricsReporter.start". Some implementations might assume an ordering while others don't. We should clarify that. # Improve lifecycle management code flow for "MetricsReporter.register" and "MetricsReporter.start": It looks like the current code attempts to do all "register" calls before any "start" call. Therefore, the reporters need to be started somewhat deep into the lifecycle of the Samza components in general. It is hard to keep track of when this happens for each separate component. For example, for "ClusterBasedJobCoordinator", "MetricsReporter.start" gets called inside "ContainerProcessManager.start", but that's not obvious unless someone steps into the code flow. -- This message was sent by Atlassian Jira (v8.3.4#803005)