-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add Embedded mode #262
Merged
Merged
Add Embedded mode #262
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,17 +100,7 @@ public TaskStatusHandler invoke(Instance instance, Future<Boolean> future, Repor | |
return TestTaskProcessor.processTestResults(instance, future, reporter); | ||
}; | ||
}); | ||
|
||
// this should all be green | ||
for (int i=0 ; i<statuses.size(); i++) { | ||
|
||
TaskStatusHandler status = statuses.get(i); | ||
|
||
status.raiseForStatus(); | ||
|
||
// It should be true - both instances ready to collect | ||
assertTrue((Boolean)status.getData()); | ||
} | ||
assertAllStatusGreen(statuses); | ||
} | ||
|
||
/** | ||
|
@@ -155,4 +145,32 @@ public TaskStatusHandler invoke(Instance instance, Future<Boolean> future, Repor | |
} | ||
} | ||
} | ||
|
||
@Test | ||
public void embeddedTaskProcessor() throws Throwable { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🍰 |
||
// null executor means embedded mode | ||
TaskProcessor testProcessor = new TaskProcessor(null, null); | ||
List<InstanceTask<Boolean>> instanceTestTasks = new ArrayList<InstanceTask<Boolean>>(); | ||
for (Instance instance: instances) { | ||
instanceTestTasks.add(new TestSimpleTask(instance)); | ||
} | ||
List<TaskStatusHandler> statuses = testProcessor.processTasks( | ||
instanceTestTasks, 0, TimeUnit.SECONDS, | ||
new TaskMethod<Boolean>() { | ||
@Override | ||
public TaskStatusHandler invoke(Instance instance, Future<Boolean> future, Reporter reporter) { | ||
return TestTaskProcessor.processTestResults(instance, future, reporter); | ||
}; | ||
}); | ||
assertTrue(statuses.size() > 0); | ||
assertAllStatusGreen(statuses); | ||
|
||
} | ||
|
||
private void assertAllStatusGreen(List<TaskStatusHandler> statuses) throws Throwable { | ||
for (TaskStatusHandler status : statuses) { | ||
status.raiseForStatus(); | ||
assertTrue((Boolean)status.getData()); | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of an embedded setting, perhaps it would be better to take an ExecutorService as an option?
What is the impact if it doesn't have these threadpools?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure to follow your point here.
In embedded mode, collectionThreadPool & recoveryThreadPool variables are null, so TaskProcessor instances don't have any ExecutorService.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then what thread is jmxfetch even running on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calling thread, i.e. the thread calling
App.run()
method.In case of the tracer, this is the
dd-jmx-collector
thread created by the tracer.see: https://github.com/DataDog/dd-trace-java/blob/master/dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java#L90