Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use injected usage supplier in RuntimeTaskImpl. #648

Closed
wants to merge 0 commits into from

Conversation

arnavdugar
Copy link

@arnavdugar arnavdugar commented Mar 29, 2024

Summary

Use injected usage supplier in RuntimeTaskImpl.

Context

Currently CgroupsMetricsCollector is hard-coded in RuntimeTaskImpl.java, so if it is overridden using the mantis.taskexecutor.metrics.collector field in the Mantis agent properties, that isn't respected. This change uses the dynamically loaded implementation of MetricsCollector.

Checklist

  • ./gradlew build compiles code correctly
  • Added new tests where applicable
  • ./gradlew test passes all tests
  • Extended README or added javadocs where applicable

@@ -99,8 +99,9 @@ public void initialize(
this.wrappedExecuteStageRequest =
new WrappedExecuteStageRequest(PublishSubject.create(), executeStageRequest);

log.info("Picking Cgroups metrics collector.");
configWritable.setMetricsCollector(CgroupsMetricsCollector.valueOf(System.getProperties()));
MetricsCollector metricsCollector = config.getUsageSupplier();
Copy link
Collaborator

@Andyz26 Andyz26 Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @arnavdugar we are trying to move away from passing objects via the config class and this config class you use here is generated from the serialized version (L94 -96) so the supplier is always empty.
If you need to support another metrics collector I would suggest adding a config value as string and then construct the metrics collector type instance based the string value instead (basically treat the current interface at initialize as entry and do not pass external instances from there). We need this assumption to support our internal wrapper to these entries.

@arnavdugar
Copy link
Author

I accidentally closed this PR, so I created #674.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants